#ifdef _OPENACC void initialisation_openacc() { char* local_rank_env; int local_rank; /* Initialisation of OpenACC */ #pragma acc init /* Recovery of the local rank of the process via the environment variable set by Slurm, as MPI_Comm_rank cannot be used here because this routine is used BEFORE the initialisation of MPI*/ local_rank_env = getenv("SLURM_LOCALID"); if (local_rank_env) { local_rank = atoi(local_rank_env); /* Define the GPU to use via OpenACC */ acc_set_device_num(local_rank, acc_get_device_type()); } else { printf("Error : impossible to determine the local rank of the process\n"); exit(1); } } #endif