A cuda package error

Dear lammps users,

An error occurred when using cuda package. I use the sw potential to calculate the thermal conductivity.

Do you have any suggestions? Thank you in advance!

Here is the error and input.

WARNING: # CUDA: You asked for a Verlet integration using Cuda, but several fixes have not yet been ported to Cuda.

This can cause a severe speed penalty due to frequent data synchronization between host and GPU. (verlet_cuda.cpp:632)

Cuda error: Cuda_CommCuda_PackReverse_Self: Kernel execution failed in file ‘comm_cuda.cu’ in line 483 : unknown error.

units metal

variable T equal 70

variable V equal vol

variable dt equal 0.001

variable p equal 20 # correlation length

variable s equal 10 # sample interval

variable d equal $p*$s # dump interval

convert from LAMMPS real units to SI

variable kB equal 1.3806504e-23 # [J/K] Boltzmann

variable eV2J equal 1.60219e-19

variable A2m equal 1.0e-10

variable ps2s equal 1.0e-12

variable convert equal {eV2J}*{eV2J}/{ps2s}/{A2m}

setup problem

dimension 3

boundary p p p

lattice diamond 5.43

region simbox block 0 6 0 6 0 6 units lattice

create_box 1 simbox

create_atoms 1 box

mass 1 28.0855

pair_style sw

pair_coeff * * Si.sw Si

neighbor 1.0 bin

neigh_modify delay 0 every 200 check no

timestep ${dt}

thermo $d

equilibration and thermalization

velocity all create $T 102486 mom yes rot yes dist gaussian

fix NVT all nvt temp $T $T 10 drag 0.2

run 200

thermal conductivity calculation, switch to NVE if desired

unfix NVT

fix NVE all nve

reset_timestep 0

compute myKE all ke/atom

compute myPE all pe/atom

compute myStress all stress/atom virial

compute flux all heat/flux myKE myPE myStress

variable Jx equal c_flux[1]/vol

variable Jy equal c_flux[2]/vol

variable Jz equal c_flux[3]/vol

fix JJ all ave/correlate $s $p $d &

c_flux[1] c_flux[2] c_flux[3] type auto file J0Jt.dat ave running

variable scale equal {convert}/{kB}/$T/$T/$V*s*{dt}

variable k11 equal trap(f_JJ[3])*${scale}

variable k22 equal trap(f_JJ[4])*${scale}

variable k33 equal trap(f_JJ[5])*${scale}

thermo_style custom step temp v_Jx v_Jy v_Jz v_k11 v_k22 v_k33

run 400

variable k equal (v_k11+v_k22+v_k33)/3.0

variable ndens equal count(all)/vol

print “average conductivity: $k[W/mK] @ T K, {ndens} /A^3”

Best Regards,


Christian can look at this.


Ok I think I found the issue. Your script in the end requests per atom virial, without requesting a global virial. That is not correctly handled by the USER-CUDA package (a certain setup thing should be done when either global vflag is set or per atom vflag is set, but it currently is only triggered if the global vflag is set). I have to fix that.

For now if you just want to do it yourself you can fix the issue by changing the following line in lib/cuda/pair_sw_cuda.cu from:

Cuda_Pair_PreKernel_AllStyles(sdata, sneighlist, eflag, vflag, grid, threads, sharedperproc, false, 64);


Cuda_Pair_PreKernel_AllStyles(sdata, sneighlist, eflag, vflag>>vflag_atom, grid, threads, sharedperproc, false, 64);

Still there is a different answer coming out for conductivity at the end. I need to figure out why that is (trajectories seem to be the same).


Thank you so much for your reply.
I agree with you. Per atom virial should be the issue.
I modified the pair_sw_cuda.cu as you suggested but still the same error

Best Regards,

Are you sure it recompiled properly? If you just modify pair_sw_cuda.cu
it does not. As a minimum you have to touch cuda_pair.cu (which includes
all the other stuff).


Sorry, the problem can be fixed after recompiling. But the simulation
results (thermal conductivity, k) are very different from the CPU
calculation results.

I think this difference may come from the per atom virial.



Hi Richard

yeah that is my current understanding. For some reason the individual
atomic virials are wrong, while the sum is correct. I am investigating.


Dear Christian,

May I know whether the problem has been fixed? I hope to continue the
simulation with cuda package because it is really efficient. Thank you!

Best Regards,