Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:21

0001 /**
0002 SRngSpecTest.cc
0003 ================
0004 
0005 This checks the existance of rngcache files eg QCurandState_1000000_0_0.bin
0006 
0007 But there have been two developments that makes this irrelevant:
0008 
0009 1. switch from monolithic QCurandState_1000000_0_0.bin to chunked 
0010    SCurandChunk_0000_0000M_0001M_0_0.bin that avoids duplication
0011 
0012 2. switch from XORWOW that needs the state files to Philox that does not 
0013 
0014 
0015 Hence this test is now removed from the active ctest list and can be deleted in future. 
0016 
0017 **/
0018 
0019 #include <sstream>
0020 #include <csignal>
0021 #include <vector>
0022 #include "SRngSpec.hh"
0023 #include "SEvt.hh"
0024 #include "OPTICKS_LOG.hh"
0025 
0026 int main(int argc, char** argv)
0027 {
0028     OPTICKS_LOG(argc, argv); 
0029 
0030     SEvt* evt = SEvt::Create(0) ; 
0031     LOG(info) << evt->brief() ; 
0032 
0033     unsigned long long seed = 0ull ; 
0034     unsigned long long offset = 0ull ; 
0035 
0036     LOG(info); 
0037 
0038 #if defined __APPLE__
0039     std::vector<unsigned> rngmax_M = { 1, 3  } ; 
0040 #else
0041     std::vector<unsigned> rngmax_M = { 1, 3, 10 } ; 
0042 #endif
0043 
0044     for(unsigned i=0 ; i < rngmax_M.size() ; i++)
0045     {
0046         unsigned rngmax = rngmax_M[i]*1000000 ; 
0047         const char* path1 = SRngSpec::CURANDStatePath(NULL, rngmax, seed, offset) ;       
0048         std::cout << path1 << std::endl ;
0049 
0050         const SRngSpec* spec = new SRngSpec(rngmax, seed, offset); 
0051         const char* path2 = spec->getCURANDStatePath(); 
0052         bool path_expect = strcmp(path1, path2) == 0 ;
0053         if(!path_expect) std::raise(SIGINT); 
0054         assert(path_expect); 
0055 
0056         std::cout << spec->desc() << std::endl ; 
0057 
0058 
0059         bool valid = spec->isValid(); 
0060         if(!valid)
0061         {
0062             LOG(error) << " invalid for rngmax " << rngmax ; 
0063         }
0064 
0065         assert( valid ); 
0066     }
0067 
0068     return 0 ; 
0069 }