Choose between CPU and GPU
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Choose between CPU and GPU
- This topic has 9 replies, 2 voices, and was last updated 4 months ago by sfraniatte.
-
AuthorPosts
-
October 14, 2024 at 10:51 am #9370sfraniatteParticipant
Dear community,
I would like to know id it is possible to have a config.mk file which allow to choose between the use of CPU or GPU to run a calculation.
Also, I have a computer with a GPU (nvidia RTX 3080Ti) and many CPU cores (64) on Ubuntu 24.04. However, I do not succeed to install Openmpi properly. When I launch a calculation with the mpirun option, the progression is not faster than when the calculation run in sequential mode… However, I succeeded to install properly on an other computer (a Ubuntu 22.04 VM on Windows 11). So my problem is to have a cuda aware installation of Openmpi.Thanks in advance,
SylvainOctober 14, 2024 at 10:54 am #9371AdrianKeymasterHow many MPI processes are detected by OpenLB? (first few lines in the terminal log)
Does the output repeat? (If so MPI is not enabled during compilation)
Did you check the user guide section 9.2.1?
October 14, 2024 at 11:07 am #9372sfraniatteParticipantWhere can I find the terminal log ? Is it when I compile Openlb at he installation ?
Yes, I did follow this section…
Thank you for your answer !
SylvainOctober 14, 2024 at 11:15 am #9373AdrianKeymasterI mean the output after you call e.g.
mpirun -np $whatever ./case
So the command in the user guide for querying whether your MPI installation is CUDA aware returns true?
October 14, 2024 at 11:23 am #9374sfraniatteParticipantOk, the first lines after this call are :
[MpiManager] Sucessfully initialized, numThreads=32
[ThreadPool] Sucessfully initialized, numThreads=1Yes, it returned true. However, I uninstalled CUDA then to have Openmpi which works properly. Because, it was not working. And it still does not work…
My main goal is to have Openmpi to use CPU. But I have the feeling that it is not possible due to the presence of the GPU card.
So, to sum up, I uninstalled CUDA and I install again Openmpi as explained in the user manual (sudo apt-get install openmpi-bin openmpi-doc libopenmpi-dev) but it still does not work properly.
Sylavin
October 14, 2024 at 11:27 am #9375AdrianKeymasterOk, so MPI is detected correctly.
What do you mean by “it still does not work”?
If you compiled with GPU support (i.e.
GPU_CUDA
is set in thePLATFORMS
array of your config) then a simplempirun -np $whatwever ./case
will use the first GPU for all 32 processes which almost certainly is not what you want. You will need to specify theCUDA_VISIBLE_DEVICES
properly to select one GPU per process (and you probably don’t have 32 GPUs in this system so you will need to reduce the number of processes accordingly, there is documentation on this e.g. in the GPU example configs).If you just want to disable GPU usage all you need to do is not enable it – i.e. just remove the
GPU_CUDA
entry fromPLATFORMS
and recompile.October 14, 2024 at 11:31 am #9376sfraniatteParticipantI mean that the calculation is not faster than in sequential mode. The calculation is faster on my other computer with 6 Threads…
Yes, indeed, I would like to use the CPUs only for now and one GPU in the future when my code will be ready for that.
Thank you for the details.
Sylvain
October 14, 2024 at 11:37 am #9377AdrianKeymasterFaster for which case in which configuration? If you are indeed using a single GPU stretched over 32 processes for (probably) a small default case it would be surprising to even get the same performance as in single threaded CPU-only mode. There are many different ways to tweak performance, given more details I’d be happy to advise.
October 14, 2024 at 11:50 am #9378sfraniatteParticipantOk, I have two computers :
_ an Ubuntu 22.04 VM on windows 11 with 6 CPU cores (Intel(R) Core(TM) i5-10400T CPU @ 2.00GHz)
_ an Ubuntu 24.04 with 32 CPU cores (AMD Ryzen Threadripper PRO 5975WX 32-Cores) and with a GPU cardMy goal, today, is to launch a calculation on the computer which run on Ubuntu 24.04 on the CPU cores to run a biger simulation. However, when I test with the same case (my own case), the calculation is slower than when it is done whith the VM on windows.
I am wondering if the problem comes from CPUs which does not have the same brand.
Sylvain
October 14, 2024 at 11:59 am #9379sfraniatteParticipantI am sorry because I understood my error… The number of cores used was to high which slow down the calculation. Stupid mistake !
Thanks a lot for your time !
Sylvain
-
AuthorPosts
- You must be logged in to reply to this topic.