# CROCO and GPU

**URL:** <https://forum.croco-ocean.org/t/croco-and-gpu/492>\
**Category:** parallelization\
**Tags:** parallelization\
**Created:** [October 24, 2023, 1:45pm UTC](https://forum.croco-ocean.org/t/croco-and-gpu/492 "2023-10-24T13:45:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndresSepulveda](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/andressepulveda/32/262_2.png) [@AndresSepulveda](https://forum.croco-ocean.org/u/AndresSepulveda)\
**Post date:** [October 24, 2023, 1:45pm UTC](https://forum.croco-ocean.org/t/croco-and-gpu/492/1 "2023-10-24T13:45:26Z")

</div>

Hi,

We would like to test the CROCO code for GPU. We have a machine with three NVIDIA GPUs and we were able to compile the code setting nvfortran in the jobcomp.

How do we tell the run\_croco.bash to use one or two GPUs?

Any help is appreciated, thanks!

---

<div class="post-metadata">

**Author:** ![Konstantinos\_K](https://forum.croco-ocean.org/letter_avatar_proxy/v4/letter/k/8797f3/32.png) [@Konstantinos\_K](https://forum.croco-ocean.org/u/Konstantinos_K)\
**Post date:** [June 25, 2024, 1:48pm UTC](https://forum.croco-ocean.org/t/croco-and-gpu/492/2 "2024-06-25T13:48:12Z")

</div>

Hi Andres,

Thank you for the info. I am also trying to compile croco for GPU but I am getting the error below. The compilation seems to reach the end when all “.o” files are copied but at that point I get the error:

"  
/usr/bin/ld: MPI\_Setup.o: in function `mpi_setup_': MPI_Setup_.f:(.text+0x130): undefined reference to `acc\_get\_num\_devices\_h\_’  
collect2: error: ld returned 1 exit status  
gmake: \*\*\* [Makefile:204: croco] Error 1  
"

I see that you mention you used “nvfortran”. Is this a requirement? Is there a simple guide including requirements for compiling croco for GPU?

My GPU is an Nvidia RTX 2000 Ada. Is there a list with compatible GPU cards that have been tested?

Thanks  
Konstantinos

---

<div class="post-metadata">

**Author:** ![AndresSepulveda](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/andressepulveda/32/262_2.png) [@AndresSepulveda](https://forum.croco-ocean.org/u/AndresSepulveda)\
**Post date:** [June 26, 2024, 6:43pm UTC](https://forum.croco-ocean.org/t/croco-and-gpu/492/3 "2024-06-26T18:43:31Z")

</div>

Hi Konstantinos,

I have a NVIDIA RTX 5000.

Did you used the NVIDIA compiler, nvfortran? It is mandatory, I understand.

---

<div class="post-metadata">

**Author:** ![Konstantinos\_K](https://forum.croco-ocean.org/letter_avatar_proxy/v4/letter/k/8797f3/32.png) [@Konstantinos\_K](https://forum.croco-ocean.org/u/Konstantinos_K)\
**Post date:** [June 27, 2024, 9:02am UTC](https://forum.croco-ocean.org/t/croco-and-gpu/492/4 "2024-06-27T09:02:30Z")

</div>

Thank you Andres. I will try with the nvfortran then.

---

<div class="post-metadata">

**Author:** ![AndresSepulveda](https://forum.croco-ocean.org/user_avatar/forum.croco-ocean.org/andressepulveda/32/262_2.png) [@AndresSepulveda](https://forum.croco-ocean.org/u/AndresSepulveda)\
**Post date:** [June 27, 2024, 12:01pm UTC](https://forum.croco-ocean.org/t/croco-and-gpu/492/5 "2024-06-27T12:01:19Z")

</div>

You need to download and install the nvidia HPC sdk toolkit

( [High Performance Computing HPC SDK | NVIDIA Developer](https://developer.nvidia.com/hpc-sdk))

activate the OPENACC key in cppdefs.h and set FC to nvfortran in jobcom.

This will make use of only one GPU.
