# Passing shared memory in device subroutine

**URL:** <https://forums.developer.nvidia.com/t/passing-shared-memory-in-device-subroutine/134619>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [September 8, 2015, 3:13pm UTC](https://forums.developer.nvidia.com/t/passing-shared-memory-in-device-subroutine/134619 "2015-09-08T15:13:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![egodfred](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@egodfred](https://forums.developer.nvidia.com/u/egodfred)\
**Post date:** [September 8, 2015, 3:13pm UTC](https://forums.developer.nvidia.com/t/passing-shared-memory-in-device-subroutine/134619/1 "2015-09-08T15:13:18Z")

</div>

I tried passing shared memory array to device subroutines , while disabling “rdc” which from what I have read so far causes issues in such cases. I will like to know why the translation fails

```nohighlight
pgfortran -g -Mcuda=nordc,llvm,ptxinfo,cc3+,keepgpu,keepptx -Minfo=ccff -O0 -c precision_m.F90
pgfortran -g -Mcuda=nordc,llvm,ptxinfo,cc3+,keepgpu,keepptx -Minfo=ccff -O0 -c cpurandom_m.F90
cpp -DGLOBAL host_gen_m.CUF > host_gen_m1.CUF
pgfortran -Mcuda=nordc,ptxinfo,cc3+,keepgpu,keepptx -Minfo=ccff -O0 -c host_gen_m1.CUF
cpp -DSHARED host_subs_m.CUF > host_subs_m1.CUF
pgfortran -Mcuda=nordc,ptxinfo,cc3+,keepgpu,keepptx -Minfo=ccff -O0 -c host_subs_m1.CUF

output message:

PGF90-F-0155-Compiler failed to translate accelerator region (see -Minfo messages): Unsupported procedure (host_subs_m1.CUF: 1)
PGF90/x86-64 Linux 14.10-0: compilation aborted
make: *** [host_subs_m1.o] Error 2

```

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [September 8, 2015, 8:23pm UTC](https://forums.developer.nvidia.com/t/passing-shared-memory-in-device-subroutine/134619/2 "2015-09-08T20:23:59Z")

</div>

Hi egodfred,

RDC is required when calling device routines from device code found in external modules or when accessing external module data from device code. Are you trying to call a external device routine?

I tried to replicate the error so I could give you a more definitive answers but didn’t see the error with the code you sent. Though I don’t see “SHARED” in the code so assuming it’s changed since then.

- Mat
