[Openmp-dev] OpenMP target offload in a subprocess

Christopher Daley via Openmp-dev openmp-dev at lists.llvm.org
Fri Jan 15 16:03:41 PST 2021


Hi all,

We are trying to use OpenMP target offload in a subprocess and get the
following error:

Target CUDA RTL --> Start initializing CUDA
Target CUDA RTL --> Init requires flags to 1
Target CUDA RTL --> Getting device 0
Target CUDA RTL --> Error returned from cuDeviceGet
Target CUDA RTL --> CUDA error is: initialization error
Libomptarget error: Device 0 is not ready.
Libomptarget error: run with env LIBOMPTARGET_INFO>1 to dump host-target
pointer maps
Libomptarget error: Build with debug information to provide more
informationLibomptarget fatal error 1: failure of target construct while
offloading is mandatory

We are targeting a NVIDIA V100 GPU using a LLVM/Clang-12 build from
December. We assume the error is because the CUDA context is started before
there has been any OpenMP API calls or directives. How can we use OpenMP
offload in the subprocess only? How can we use OpenMP offload in the
original process and the subprocess? We have attached a toy code that fails
with the message above when defining USE_CHILD_PROCESS. The key code is
shown below:

int main()
{
  int mypid = fork();
  if( 0 == mypid ) {
#ifdef USE_CHILD_PROCESS
    printf("Calling from child process\n");
    cfunc(); // contains OpenMP target offload
#endif
  } else {
#ifndef USE_CHILD_PROCESS
    printf("Calling from parent process\n");
    cfunc(); // contains OpenMP target offload
#endif
  }
  return 0;
}

Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20210115/59cb5d52/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: application/octet-stream
Size: 971 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20210115/59cb5d52/attachment.obj>


More information about the Openmp-dev mailing list