Error using StdPar with Managed memory

Running a case using Fortran StdParallelism, although I think same error occurs using ACC parallel loops directive as well. I have attached code/makefile along with a test case. If I compile code as delivered (-gpu:unified), the code runs fine as per test case. If I modify Makefile to use -gpu:managed and recompile (after doing make clean), I get following error message while running …

Failing in Thread:1
Accelerator Fatal Error: call to cuStreamSynchronize returned error 700 (CUDA_ERROR_ILLEGAL_ADDRESS): Illegal address during kernel execution
File: /storage/users/kenzakow/SIMPLE_SOLV/SendCase/CHEM_STDPAR2/chmrhs_dcpl_gpu3i.f
Function: gpucc_chemistry:580
Line: 613

I am not using cuda streams for this code and am not sure where cuStreamSynchronize() has been inserted.

ManagedMemoryIssue_TGZ.txt (441.3 KB)

Hi Don,

The key difference between “unified” and “managed” is that with unified, all memory is accessible (global, stack, heap) between the host and device, while only heap (allocated) memory is accessible with “managed”.

This error seems to be coming from one of the subroutine calls which directly access module variables stored in static global memory. My guess it’s one of these that’s causing the issue given this memory is not accessible on the device.

I can dig further if you do need managed memory to work, but it likely means adding the CUDA Fortran device attribute (as you do in the gpu_common module), or add the OpenACC “declare create” directive and then update the device values from the host. Additional changes may be needed as well.

Alternatively, we can change the code so it doesn’t need to access module variables, or make them all allocatable so they are stored in the heap.

Though if want to only use STDPAR and limit code changes, using unified is the way to go.

-Mat