21 #include "../external/xgetopt/XGetopt.h"
25 #include "../scheduling/Clock.h"
26 #include "../msg/DiagonalMsg.h"
27 #include "../msg/SparseMsg.h"
28 #include "../mpi/PostMaster.h"
32 #include "../shell/Shell.h"
34 #include <sys/sysctl.h>
40 #define MOOSE_TEST(name, f ) \
41 cout << "[TEST " << setw(2) << testIndex << "] " << name; \
44 cout << std::right << " [DONE]" << endl; \
46 extern void testSync();
48 extern void testSyncArray(
unsigned int size,
unsigned int method );
80 unsigned int size,
unsigned int runsteps );
83 extern void testSmoldyn();
95 unsigned int numCPU = 0;
98 GetSystemInfo( &sysinfo );
100 numCPU = sysinfo.dwNumberOfProcessors;
104 numCPU = sysconf( _SC_NPROCESSORS_ONLN );
109 size_t len =
sizeof(numCPU);
113 mib[1] = HW_AVAILCPU;
116 sysctl(mib, 2, &numCPU, &len, NULL, 0);
121 sysctl( mib, 2, &numCPU, &len, NULL, 0 );
126 cout <<
"No CPU information available. Assuming single core." << endl;
140 cout << info <<
" checkChildren of " <<
142 ret.size() <<
" children\n";
143 for ( vector< Id >::iterator i = ret.begin(); i != ret.end(); ++i )
145 cout << i->element()->getName() << endl;
151 unsigned int& benchmark )
167 MPI_Init( &argc, &argv );
169 MPI_Comm_size( MPI_COMM_WORLD, &numNodes );
170 MPI_Comm_rank( MPI_COMM_WORLD, &myNode );
182 while ( ( opt = getopt( argc, argv,
"hiqurn:b:B:" ) ) != -1 )
190 numNodes = (
unsigned int)atoi( optarg );
197 else if ( s ==
"gsl" )
199 else if ( s ==
"gssa" )
201 else if ( s[0] ==
'i' )
203 else if ( s[0] ==
'h' )
205 else if ( s[0] ==
'm' )
208 cout <<
"Unknown benchmark, " << optarg <<
", skipping\n";
217 doRegressionTests = 1;
224 cout <<
"Usage: moose -help -infiniteLoop -unit_tests -regression_tests -quit -n numNodes -benchmark [ee gsl gssa intFire hhNet msg_<msgType>_<size>]\n";
232 cout <<
"on node " << myNode <<
", numNodes = "
233 << numNodes <<
", numCores = " << numCores << endl;
242 assert( clockId.
value() == 1 );
258 assert ( shellId ==
Id() );
259 assert( clockId ==
Id( 1 ) );
260 assert( classMasterId ==
Id( 2 ) );
261 assert( postMasterId ==
Id( 3 ) );
271 assert( numMsg == 10 );
307 MOOSE_TEST(
"testMsg",
testMsg());
359 #if ! defined(PYMOOSE) && ! defined(MOOSE_LIB)
360 int main(
int argc,
char** argv )
364 unsigned int benchmark = 0;
367 Id shellId =
init( argc, argv, doUnitTests, doRegressionTests, benchmark );
396 if ( benchmark != 0 )
static unsigned int numCores
static void makeCinfoElements(Id parent)
Id init(int argc, char **argv, bool &doUnitTests, bool &doRegressionTests, unsigned int &benchmark)
static void clearAllElements()
static unsigned int numCores()
Element * element() const
Synonym for Id::operator()()
void doSetClock(unsigned int tickNum, double dt)
unsigned int value() const
int main(int argc, char **argv)
static const Cinfo * initCinfo()
void testSigNeurProcess()
static void setHardware(unsigned int numCores, unsigned int numNodes, unsigned int myNode)
static void launchParser()
static void children(const Eref &e, vector< Id > &ret)
void testBuiltinsProcess()
static const Cinfo * initCinfo()
void processTests(Shell *s)
void mooseBenchmarks(unsigned int option)
void setShellElement(Element *shelle)
static int doRegressionTests
static unsigned int myNode
void testSchedulingProcess()
void nonMpiTests(Shell *s)
static bool keepLooping()
static void loadBalance()
void checkChildren(Id parent, const string &info)
void testBiophysicsProcess()
void clearPending()
All arrived messages and set calls are handled and cleared.
static unsigned int numNodes
virtual char * data(unsigned int rawIndex, unsigned int fieldIndex=0) const =0
unsigned int getNumCores()
static unsigned int initMsgManagers()
static void rebuildOpIndex()
static bool adopt(ObjId parent, Id child, unsigned int msgIndex)
void destroyMsgManagers()
static unsigned int myNode()
void doUseClock(string path, string field, unsigned int tick)
static const Cinfo * initCinfo()
static const Cinfo * initCinfo()
static unsigned int numNodes()
const string & getName() const
void speedTestMultiNodeIntFireNetwork(unsigned int size, unsigned int runsteps)
static void clearAllMsgs()