device data on a different module

Hi,
May I ask the current status of using device data as well as kernels defined in one module and being used in another module in CUDA Fortran. Has it been fully supported or not.

Thanks,
Tuan

Hi Tuan,

Yes, this has been supported since 11.6. Caveat is that this requires runtime support only available on a card with Compute Capability 2.0 (Fermi) or greater and CUDA 4.0 or later.

  • Mat

Hi Mat,
I defined a attributes(device,host) subprogram from another module and I get the following error.

PGF90-S-0155-Illegal call of a device routine from another module - state_breakdown (src/ecc_gpu_utility.f95: 998)
  0 inform,   0 warnings,   1 severes, 0 fatal for get_comppdt_2
PGF90-S-0155-Illegal call of a device routine from another module - state_breakdown (src/ecc_gpu_utility.f95: 1059)
  0 inform,   0 warnings,   1 severes, 0 fatal for get_comppdt_2b
PGF90-S-0155-Illegal call of a device routine from another module - state_breakdown (src/ecc_gpu_utility.f95: 1129)
PGF90-S-0155-Illegal call of a device function from another module - state_combine_single (src/ecc_gpu_utility.f95: 1257)
  0 inform,   0 warnings,   2 severes, 0 fatal for updatesystem_2
PGF90-S-0155-Illegal call of a device routine from another module - state_breakdown (src/ecc_gpu_utility.f95: 1367)
PGF90-S-0155-Illegal call of a device function from another module - state_combine_single (src/ecc_gpu_utility.f95: 1504)
  0 inform,   0 warnings,   2 severes, 0 fatal for updatesystem_2b

I remembered that the previous versions of PGI CUDA Fortran didn’t do well on code combining device and host subprogram, and suggested users to write 2 separately. How about the status in 12.2 version?

Thanks,
Tuan

Hi Tuan,

While I don’t think our engineers have entirely given-up on “attributes(device,host)”, it turned out to be extremely difficult to implement so has not be done yet.

Note, that I should have prefaced my earlier post with that only global kernels can be called externally. Device routines are only callable from within the same module.

  • Mat

Hi Mat,
I want to ask a question. Is there a trade-off when declaring device data on one module and use it in kernels from another module, compared to putting kernel and device data in the same module.

Thanks,
Tuan

Hi Tuan,

Performance-wise there’s not much of a difference. The external module data requires a runtime look-up call to get the address, but it’s impact is small.

  • Mat