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