fix bug for segfault if without cudaSetDevice
This commit is contained in:
parent
ef77421142
commit
91e94ad3a6
|
@ -8,11 +8,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <thread>
|
||||
|
||||
/*
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Initialize the device
|
||||
*/
|
||||
|
@ -112,6 +107,9 @@ int schedulerEnqueueKernel(cu_kernel *k) {
|
|||
Kernel Launch with numBlocks and numThreadsPerBlock
|
||||
*/
|
||||
int cuLaunchKernel(cu_kernel **k) {
|
||||
if (!device_initilized) {
|
||||
init_device();
|
||||
}
|
||||
// Calculate Block Size N/numBlocks
|
||||
cu_kernel *ker = *k;
|
||||
int status = C_RUN;
|
||||
|
@ -239,7 +237,7 @@ void cuSynchronizeBarrier() {
|
|||
init_device();
|
||||
}
|
||||
while (1) {
|
||||
// (TODO): currently, we assume each kernel launch will have a
|
||||
// (TODO): currently, we assume each kernel launch has a
|
||||
// following sync
|
||||
if (scheduler->kernelQueue->size_approx() == 0) {
|
||||
int completeBlock = 0;
|
||||
|
|
Loading…
Reference in New Issue