0
votes

I want to parallelize a Python loop on GPU, but I don't want to use pyCUDA, because I need to do lots of thing myself. I am looking for something like OpenACC as in C++ for Python to implement the simple parallelization, but it seems no such thing. So I am thinking just using OpenACC in C++ and then system call a Python script, as in the code below. Will this work? Or is there any simple alternative without using pyCUDA?

void foo(float*parameters){

%%system call python function with parameters as input 

}

#pragma acc parallel loop
for ( int i=0; i<n; ++i) {
  foo(parameters[i]);
  //call on the device
}
1

1 Answers

1
votes

No, this wont work. You can't execute a host system call from the device.

For OpenACC device code, you can only call routines having the OpenACC "routine" directive, or a CUDA "device" routine.