X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda%2Fsrc%2Fcpp%2Fmain.cpp;h=7c3dc4262f8c4e5354ff0db4c2ffe6adcc127ac9;hb=6664817ed89b0b616044da35a3eb8f715e0813d9;hp=3fad4508230608599458964b5b377392ee579b07;hpb=8d08c12b29c2a14684f35c023ee39e694bb80d25;p=GPU.git diff --git a/WCudaMSE/Student_Cuda/src/cpp/main.cpp b/WCudaMSE/Student_Cuda/src/cpp/main.cpp index 3fad450..7c3dc42 100755 --- a/WCudaMSE/Student_Cuda/src/cpp/main.cpp +++ b/WCudaMSE/Student_Cuda/src/cpp/main.cpp @@ -1,13 +1,12 @@ #include +#include #include #include +using namespace std; #include "cudaTools.h" #include "Device.h" -#include "LimitsTools.h" - -using std::cout; -using std::endl; +#include "LimitsTools.h" /*----------------------------------------------------------------------*\ |* Declaration *| @@ -17,21 +16,21 @@ using std::endl; |* Imported *| \*-------------------------------------*/ -extern int mainCore(); +extern int mainCore(const vector& args); extern int mainTest(); /*--------------------------------------*\ |* Public *| \*-------------------------------------*/ -int main(void); +int main(int argc, char** argv); /*--------------------------------------*\ |* Private *| \*-------------------------------------*/ static void initCuda(int deviceId); -static int start(void); +static int start(const vector& args); /*----------------------------------------------------------------------*\ |* Implementation *| @@ -41,22 +40,26 @@ static int start(void); |* Public *| \*-------------------------------------*/ -int main(void) +int main(int argc, char** argv) { cout << "main" << endl; + vector args; + for (int i = 1; i < argc; ++i) + args.push_back(argv[i]); + // LimitsTools::rappelTypeSize(); if (Device::isCuda()) { - Device::printAll(); + Device::printAll(); Device::printAllSimple(); // Server Cuda1: in [0,5] // Server Cuda2: in [0,2] int deviceId = 0; - int isOk = start(); + int isOk = start(args); //cudaDeviceReset causes the driver to clean up all state. // While not mandatory in normal operation, it is good practice. @@ -86,19 +89,17 @@ void initCuda(int deviceId) // Device::loadCudaDriverAll();// Force driver to be load for all GPU } -int start(void) +int start(const vector& args) { Device::printCurrent(); - bool IS_TEST = true; - - if (IS_TEST) - { + if (args.size() == 0 || args[0] == "tests") + { return mainTest(); } else { - return mainCore(); + return mainCore(args); } }