OpenMP target device selection syntax issue

Hi,

I am using OpenMP target data directives in POT3D (GitHub - predsci/POT3D: POT3D: High Performance Potential Field Solver · GitHub) .

I set the device number based on the shared MPI rank (1 MPI rank per GPU) with:

!$ call omp_set_default_device (iprocsh)

On some other compilers, there was a problem where this was being seen as a comment due to the space(s) between the $ and the “call”.

However, if I remove the space(s):

!$call omp_set_default_device (iprocsh)

the code no longer selects the device and breaks the code.

According to an AI search, it should not matter if there are spaces or not but that NOT having a space is better conforming.

Since i need to run on multiple compilers, could nvfortran be updated to have this work without the space(s)?

Thanks!

– Ron

Hi Ron,

I believe AI is wrong here. This would not be standard compliant as the conditional compilation sentinel requires a space after the sentinel. See: Free Source Form Conditional Compilation Sentinel

To enable conditional compilation, a line with a conditional compilation sentinel must satisfy the following criteria:

  • The sentinel can appear in any column but must be preceded only by white space;
  • The sentinel must appear as a single word with no intervening white space;
  • Initial lines must have a space after the sentinel;
  • Continued lines must have an ampersand as the last non-blank character on the line, prior to any comment appearing on the conditionally compiled line.

While this is from the 5.0 standard, 6.0 is the same, just in section 5.3.1:

-Mat