Common Statement

Hello,
I’m trying to accelerate a code which uses the common statement, how can I substitute it in order to be compatible with CUDA?
Thanks

Hi ElMaskina,

No need to change the code other than COMMON blocks have been superceeded by modules. If you are rewritting the code, I’d move to using module data but common blocks can be used in CUDA Fortran.

  • Mat

Common blocks are not allowed in device code, isn’t it?

The manual seems to support this assertion:

These rules apply to device data:
...snip...
• Device variables and arrays may appear in modules, but may not be in a Common block or an Equivalence statement.

As Mat said, I’ve moved some old COMMON code to be module variables which are then moved into device or constant memory (as appropriate).

Matt

Ugh, am I giving wrong information again? Sorry… No, commons are not allowed for device data since they are static. In OpenACC they are fine.

  • Mat