Hello,
Just a note that I managed to solve the problem. Here is the solution, in case someone else faces the same issue:
Instead of the “!$ACC DECLARE TARGET LINK(NR)” directive in common_vars.f90 I used “!$ACC DECLARE TARGET TO(NR)”. In addition, before entering the region to be executed on the GPU, I added the directive “!$ACC UPDATE DEVICE(NR)” to update the value of NR on the device with the latest value from the host (in test_link.f90).
Ioannis