This commit checks for an existing CUDA context (using cuCtxGetCurrent), before creating a new context. If an existing context exists, no new context is created. This change ensures that all allocations made in the program interacting with the openmp offload library are visible in the device context; especially important for CUDA managed allocations (using cudaMallocManaged).
For the existing version, if a context exists, the cuCtxCreate call fails, and hence all further allocations crash.
Thanks to Hashim Sharif, University of Illinois at Urbana, for spotting the problem and submitting the original patch.
Spaces needed before/after parens.