9 #include "LimitsTools.h"
11 /*----------------------------------------------------------------------*\
13 \*---------------------------------------------------------------------*/
15 /*--------------------------------------*\
17 \*-------------------------------------*/
19 extern int mainCore(const vector
<string
>& args
);
20 extern int mainTest();
22 /*--------------------------------------*\
24 \*-------------------------------------*/
26 int main(int argc
, char** argv
);
28 /*--------------------------------------*\
30 \*-------------------------------------*/
32 static void initCuda(int deviceId
);
33 static int start(const vector
<string
>& args
);
35 /*----------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------*/
39 /*--------------------------------------*\
41 \*-------------------------------------*/
43 int main(int argc
, char** argv
)
45 cout
<< "main" << endl
;
48 for (int i
= 1; i
< argc
; ++i
)
49 args
.push_back(argv
[i
]);
51 // LimitsTools::rappelTypeSize();
56 Device::printAllSimple();
58 // Server Cuda1: in [0,5]
59 // Server Cuda2: in [0,2]
62 int isOk
= start(args
);
64 //cudaDeviceReset causes the driver to clean up all state.
65 // While not mandatory in normal operation, it is good practice.
66 HANDLE_ERROR(cudaDeviceReset());
76 void initCuda(int deviceId
)
78 // Check deviceId area
79 int nbDevice
= Device::getDeviceCount();
80 assert(deviceId
>= 0 && deviceId
< nbDevice
);
82 //HANDLE_ERROR(cudaDeviceReset());
84 // Choose current device (state of host-thread)
85 HANDLE_ERROR(cudaSetDevice(deviceId
));
87 // It can be usefull to preload driver, by example to practice benchmarking! (sometimes slow under linux)
88 Device::loadCudaDriver(deviceId
);
89 // Device::loadCudaDriverAll();// Force driver to be load for all GPU
92 int start(const vector
<string
>& args
)
94 Device::printCurrent();
96 if (args
.size() == 0 || args
[0] == "tests")
102 return mainCore(args
);
106 /*----------------------------------------------------------------------*\
108 \*---------------------------------------------------------------------*/