X-Git-Url: http://git.euphorik.ch/?p=GPU.git;a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda%2Fsrc%2Fcpp%2Fmain.cpp;h=7c3dc4262f8c4e5354ff0db4c2ffe6adcc127ac9;hp=495aa65798c73392d725c447588836fe300adc6a;hb=6664817ed89b0b616044da35a3eb8f715e0813d9;hpb=ee885ed84f2ff3d5fb1e7ac41fa3c8879314ee36 diff --git a/WCudaMSE/Student_Cuda/src/cpp/main.cpp b/WCudaMSE/Student_Cuda/src/cpp/main.cpp index 495aa65..7c3dc42 100755 --- a/WCudaMSE/Student_Cuda/src/cpp/main.cpp +++ b/WCudaMSE/Student_Cuda/src/cpp/main.cpp @@ -1,14 +1,13 @@ #include +#include #include #include +using namespace std; #include "cudaTools.h" #include "Device.h" #include "LimitsTools.h" -using std::cout; -using std::endl; - /*----------------------------------------------------------------------*\ |* 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,10 +40,14 @@ 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()) @@ -56,7 +59,7 @@ int main(void) // 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 = false; - - if (IS_TEST) - { + if (args.size() == 0 || args[0] == "tests") + { return mainTest(); } else { - return mainCore(); + return mainCore(args); } }