About assign gpu for lammps

Hello, everyone,

I find a strange thing. I run my program on cuda (gpu) using following command (I want to assign NO. 4 and 5 gpu to run)

mpirun -np 4 lmp -sf gpu -pk gpu 2 gpuiD 4 5 -in in.dpd

There are four gpus (from No.0 t0 No. 3) that have been used, and No. 4 and 5 are empty. However, after I run my program using above command, this program still runs on No.0 gpu instead of No.4 and 5. Why this occurs? How to assign gpu for lammps? Many thanks!

Best wishes,

Yijing Nie

what version of LAMMPS exactly is this with. what is the output you get on the screen?

an alternate approach might be to set the CUDA_VISIBLE_DEVICES environment variable as needed.

axel.

Thank you for your reply.

I now try to use user-uef package in lammps running on cuda (gpu). After I run the program, this program just stop and the screen shows “Cannot use package gpu neigh yes with triclinic box”. Then, I add a line in the front of the input file “package gpu 2 neigh no”, and then the program successfully start in gpu. I assign this program to No. 4 and 5 gpus; however, my assignment does not work and the program just works in No. 0 gpu.

Then, I try another way. I add a line “package gpu 2 gpuID 5 6” in front of the line “package gpu 2 neigh no” in the input file, and the program still works on No. 0 gpu. However, if I add the line “package gpu 2 gpuID 5 6” after the line “package gpu 2 neigh no” in the input file, from screen I find that the assignment of gpu works, but the program then stops and the screen also shows “package gpu neigh yes with triclinic box”. Maybe if the uef package is used with “package gpu 2 neigh no”, gpu cannot be assgined.

Yijing

Thank you for your reply.

you thank me for my reply, but you neither answer my questions nor do you make any attempt to follow my suggestion (or give any indication that you tried and failed). that is not showing a lot of respect.

I now try to use user-uef package in lammps running on cuda (gpu). After I run the program, this program just stop and the screen shows “Cannot use package gpu neigh yes with triclinic box”. Then, I add a line in the front of the input file “package gpu 2 neigh no”, and then the program successfully start in gpu. I assign this program to No. 4 and 5 gpus; however, my assignment does not work and the program just works in No. 0 gpu.

Then, I try another way. I add a line “package gpu 2 gpuID 5 6” in front of the line “package gpu 2 neigh no” in the input file, and the program still works on No. 0 gpu. However, if I add the line “package gpu 2 gpuID 5 6” after the line “package gpu 2 neigh no” in the input file, from screen I find that the assignment of gpu works, but the program then stops and the screen also shows “package gpu neigh yes with triclinic box”. Maybe if the uef package is used with “package gpu 2 neigh no”, gpu cannot be assgined.

your logic is faulty and missing the point. having a non-orthogonal box is completely independent from using the USER-UEF package. it is a documented restriction of the GPU package that it cannot build neighbor lists for non-orthogonal simulation boxes.

it is also a documented feature of the package command (or the -pk flag), that it is not working incrementally, but will reset all previous settings to their default values, when specified a second time. so LAMMPS is behaving exactly as documented, but you are not using it correctly according to what you want to achieve.

please re-read the relevant sections of the LAMMPS manual and particularly the documentation of the package command again with more care.

axel.

Hi, Axel, sorry for that. I use the latest version of lammps. I followed your suggestion, and read the manual about package command carefully. Then I changed the line into “package gpu 2 gpuID 5 6 neigh no”, and the assignment works. Many thanks!

Yijing

Hi, Axel, sorry for that. I use the latest version of lammps.

please note, that “the latest version” is a very unscientific and inexact description, as it depends on the time when you downloaded it (which we don’t know) and it doesn’t say how and where you downloaded it, so whether it is the latest stable version or the latest (development) patch version or the current development master branch. if however, you provide us with the date, as explained at the very beginning of the LAMMPS manual ( https://lammps.sandia.gov/doc/Manual_version.html ), then you are making a precise and accurate statement.

I followed your suggestion, and read the manual about package command carefully. Then I changed the line into “package gpu 2 gpuID 5 6 neigh no”, and the assignment works. Many thanks!

lesson: always read the manual and always read it carefully!

axel.