Making LAMMPS with CUDA on ubuntu 13.10

Hi all,

We’ve recently added some high performance workstations to our office so I’ve been trying to compile Lammps with CUDA on Ubuntu 13.10 OS. I’ve been able to compile a normal lammps install with no additional packages, however similar to http://lammps.sandia.gov/threads/msg31386.html I cannot compile with CUDA.

I’ve installed the CUDA library, and pointed to it in all the cuda files, however when compiling I get the following error:

mpic++ -g -O3 -L…/…/lib/cuda -L…/…/lib/gpu -L…/…/lib/colvars -L/usr/local/cuda/lib -L/usr/local/cuda/lib64 -lcufft -L/usr/local/cuda/lib64 angle_charmm.o angle_class2.o angle_cosine.o angle_cosine_delta.o angle_cosine_periodic.o angle_cosine_shift.o angle_cosine_shift_exp.o angle_cosine_squared.o angle.o angle_dipole.o angle_fourier.o angle_fourier_simple.o angle_harmonic.o angle_hybrid.o angle_quartic.o angle_table.o atom.o atom_map.o atom_vec_angle.o atom_vec_angle_cuda.o atom_vec_atomic.o atom_vec_atomic_cuda.o atom_vec_body.o atom_vec_bond.o atom_vec_charge.o atom_vec_charge_cuda.o atom_vec.o atom_vec_ellipsoid.o atom_vec_full.o atom_vec_full_cuda.o atom_vec_hybrid.o atom_vec_line.o atom_vec_molecular.o atom_vec_sphere.o atom_vec_template.o atom_vec_tri.o balance.o body.o bond_class2.o bond.o bond_fene.o bond_fene_expand.o bond_harmonic.o bond_harmonic_shift.o bond_harmonic_shift_cut.o bond_hybrid.o bond_morse.o bond_nonlinear.o bond_quartic.o bond_table.o change_box.o citeme.o colvarproxy_lammps.o comm_brick.o comm.o comm_cuda.o comm_tiled.o compute_ackland_atom.o compute_angle_local.o compute_atom_molecule.o compute_basal_atom.o compute_bond_local.o compute_centro_atom.o compute_cluster_atom.o compute_cna_atom.o compute_com.o compute_com_molecule.o compute_contact_atom.o compute_coord_atom.o compute.o compute_dihedral_local.o compute_displace_atom.o compute_erotate_rigid.o compute_erotate_sphere_atom.o compute_erotate_sphere.o compute_event_displace.o compute_group_group.o compute_gyration.o compute_gyration_molecule.o compute_heat_flux.o compute_improper_local.o compute_inertia_molecule.o compute_ke_atom.o compute_ke.o compute_ke_rigid.o compute_msd.o compute_msd_molecule.o compute_msd_nongauss.o compute_pair.o compute_pair_local.o compute_pe_atom.o compute_pe.o compute_pe_cuda.o compute_pressure.o compute_pressure_cuda.o compute_property_atom.o compute_property_local.o compute_property_molecule.o compute_rdf.o compute_reduce.o compute_reduce_region.o compute_slice.o compute_stress_atom.o compute_temp_com.o compute_temp.o compute_temp_cuda.o compute_temp_deform.o compute_temp_partial.o compute_temp_partial_cuda.o compute_temp_profile.o compute_temp_ramp.o compute_temp_region.o compute_temp_rotate.o compute_temp_sphere.o compute_ti.o compute_vacf.o create_atoms.o create_box.o cuda.o cuda_neigh_list.o delete_atoms.o delete_bonds.o dihedral_charmm.o dihedral_class2.o dihedral_cosine_shift_exp.o dihedral.o dihedral_fourier.o dihedral_harmonic.o dihedral_helix.o dihedral_hybrid.o dihedral_multi_harmonic.o dihedral_nharmonic.o dihedral_opls.o dihedral_quadratic.o dihedral_table.o displace_atoms.o domain.o domain_cuda.o dump_atom.o dump_cfg.o dump.o dump_custom.o dump_dcd.o dump_image.o dump_local.o dump_molfile.o dump_movie.o dump_xtc.o dump_xyz.o error.o ewald.o ewald_disp.o fft3d.o fft3d_cuda.o fft3d_wrap.o fft3d_wrap_cuda.o finish.o fix_adapt.o fix_addforce.o fix_addforce_cuda.o fix_addtorque.o fix_ave_atom.o fix_ave_correlate.o fix_aveforce.o fix_aveforce_cuda.o fix_ave_histo.o fix_ave_spatial.o fix_ave_time.o fix_balance.o fix_box_relax.o fix_colvars.o fix.o fix_deform.o fix_deposit.o fix_drag.o fix_dt_reset.o fix_efield.o fix_enforce2d.o fix_enforce2d_cuda.o fix_evaporate.o fix_event.o fix_event_prd.o fix_event_tad.o fix_external.o fix_gld.o fix_gpu.o fix_gravity.o fix_gravity_cuda.o fix_group.o fix_heat.o fix_imd.o fix_indent.o fix_langevin.o fix_lineforce.o fix_minimize.o fix_momentum.o fix_move.o fix_neb.o fix_nh.o fix_nh_cuda.o fix_nh_sphere.o fix_nph.o fix_nph_sphere.o fix_npt.o fix_npt_cuda.o fix_npt_sphere.o fix_nve.o fix_nve_cuda.o fix_nve_limit.o fix_nve_noforce.o fix_nve_sphere.o fix_nvt.o fix_nvt_cuda.o fix_nvt_sllod.o fix_nvt_sphere.o fix_oneway.o fix_orient_fcc.o fix_planeforce.o fix_press_berendsen.o fix_print.o fix_property_atom.o fix_read_restart.o fix_recenter.o fix_respa.o fix_restrain.o fix_rigid.o fix_rigid_nh.o fix_rigid_nh_small.o fix_rigid_nph.o fix_rigid_nph_small.o fix_rigid_npt.o fix_rigid_npt_small.o fix_rigid_nve.o fix_rigid_nve_small.o fix_rigid_nvt.o fix_rigid_nvt_small.o fix_rigid_small.o fix_setforce.o fix_set_force_cuda.o fix_shake.o fix_shake_cuda.o fix_shear_history.o fix_smd.o fix_spring.o fix_spring_rg.o fix_spring_self.o fix_store.o fix_store_force.o fix_store_state.o fix_temp_berendsen.o fix_temp_berendsen_cuda.o fix_temp_csvr.o fix_temp_rescale.o fix_temp_rescale_cuda.o fix_temp_rescale_limit_cuda.o fix_thermal_conductivity.o fix_ti_rs.o fix_ti_spring.o fix_tmd.o fix_ttm.o fix_tune_kspace.o fix_vector.o fix_viscosity.o fix_viscous.o fix_viscous_cuda.o fix_wall.o fix_wall_harmonic.o fix_wall_lj1043.o fix_wall_lj126.o fix_wall_lj93.o fix_wall_reflect.o fix_wall_region.o force.o gridcomm.o group.o group_ndx.o image.o improper_class2.o improper_cossq.o improper.o improper_cvff.o improper_fourier.o improper_harmonic.o improper_hybrid.o improper_ring.o improper_umbrella.o input.o integrate.o irregular.o kspace.o lammps.o lattice.o library.o main.o math_extra.o memory.o min_cg.o min.o min_fire.o min_hftn.o minimize.o min_linesearch.o min_quickmin.o min_sd.o modify.o modify_cuda.o molecule.o molfile_interface.o msm_cg.o msm.o neb.o neigh_bond.o neighbor.o neighbor_cuda.o neigh_derive.o neigh_full.o neigh_full_cuda.o neigh_gran.o neigh_half_bin.o neigh_half_multi.o neigh_half_nsq.o neigh_list.o neigh_request.o neigh_respa.o neigh_stencil.o output.o pair_beck.o pair_beck_gpu.o pair_born_coul_long.o pair_born_coul_long_cuda.o pair_born_coul_long_gpu.o pair_born_coul_msm.o pair_born_coul_wolf.o pair_born_coul_wolf_gpu.o pair_born.o pair_born_gpu.o pair_buck_coul_cut.o pair_buck_coul_cut_cuda.o pair_buck_coul_cut_gpu.o pair_buck_coul_long.o pair_buck_coul_long_cuda.o pair_buck_coul_long_gpu.o pair_buck_coul_msm.o pair_buck.o pair_buck_cuda.o pair_buck_gpu.o pair_buck_long_coul_long.o pair_coul_cut.o pair_coul_cut_gpu.o pair_coul_debye.o pair_coul_debye_gpu.o pair_coul_diel.o pair_coul_dsf.o pair_coul_dsf_gpu.o pair_coul_long.o pair_coul_long_gpu.o pair_coul_msm.o pair_coul_wolf.o pair.o pair_dpd.o pair_dpd_gpu.o pair_dpd_tstat.o pair_dpd_tstat_gpu.o pair_edip.o pair_gauss.o pair_gauss_cut.o pair_gauss_gpu.o pair_hbond_dreiding_lj.o pair_hbond_dreiding_morse.o pair_hybrid.o pair_hybrid_overlay.o pair_list.o pair_lj96_cut.o pair_lj96_cut_cuda.o pair_lj96_cut_gpu.o pair_lj_charmm_coul_charmm.o pair_lj_charmm_coul_charmm_cuda.o pair_lj_charmm_coul_charmm_implicit.o pair_lj_charmm_coul_charmm_implicit_cuda.o pair_lj_charmm_coul_long.o pair_lj_charmm_coul_long_cuda.o pair_lj_charmm_coul_long_gpu.o pair_lj_charmm_coul_msm.o pair_lj_class2_coul_cut.o pair_lj_class2_coul_cut_cuda.o pair_lj_class2_coul_long.o pair_lj_class2_coul_long_cuda.o pair_lj_class2_coul_long_gpu.o pair_lj_class2.o pair_lj_class2_cuda.o pair_lj_class2_gpu.o pair_lj_cubic.o pair_lj_cut_coul_cut.o pair_lj_cut_coul_cut_cuda.o pair_lj_cut_coul_cut_gpu.o pair_lj_cut_coul_debye.o pair_lj_cut_coul_debye_cuda.o pair_lj_cut_coul_debye_gpu.o pair_lj_cut_coul_dsf.o pair_lj_cut_coul_dsf_gpu.o pair_lj_cut_coul_long.o pair_lj_cut_coul_long_cuda.o pair_lj_cut_coul_long_gpu.o pair_lj_cut_coul_msm.o pair_lj_cut_coul_msm_gpu.o pair_lj_cut.o pair_lj_cut_cuda.o pair_lj_cut_experimental_cuda.o pair_lj_cut_gpu.o pair_lj_cut_tip4p_cut.o pair_lj_cut_tip4p_long.o pair_lj_expand.o pair_lj_expand_cuda.o pair_lj_expand_gpu.o pair_lj_gromacs_coul_gromacs.o pair_lj_gromacs_coul_gromacs_cuda.o pair_lj_gromacs.o pair_lj_gromacs_cuda.o pair_lj_gromacs_gpu.o pair_lj_long_coul_long.o pair_lj_long_tip4p_long.o pair_lj_sf.o pair_lj_sf_dipole_sf.o pair_lj_sf_dipole_sf_gpu.o pair_lj_smooth.o pair_lj_smooth_cuda.o pair_lj_smooth_linear.o pair_meam_spline.o pair_meam_sw_spline.o pair_mie_cut.o pair_mie_cut_gpu.o pair_morse.o pair_morse_cuda.o pair_morse_gpu.o pair_nm_cut_coul_cut.o pair_nm_cut_coul_long.o pair_nm_cut.o pair_soft.o pair_soft_gpu.o pair_table.o pair_table_gpu.o pair_tersoff_table.o pair_tip4p_cut.o pair_tip4p_long.o pair_yukawa.o pair_yukawa_gpu.o pair_zbl.o pppm_cg.o pppm.o pppm_cuda.o pppm_disp.o pppm_disp_tip4p.o pppm_gpu.o pppm_old.o pppm_stagger.o pppm_tip4p.o prd.o procmap.o random_mars.o random_park.o rcb.o read_data.o read_dump.o reader.o reader_molfile.o reader_native.o reader_xyz.o read_restart.o region_block.o region_cone.o region.o region_cylinder.o region_intersect.o region_plane.o region_prism.o region_sphere.o region_union.o remap.o remap_wrap.o replicate.o rerun.o respa.o run.o set.o special.o tad.o temper.o thermo.o timer.o universe.o update.o variable.o velocity.o verlet.o verlet_cuda.o verlet_split.o write_data.o write_dump.o write_restart.o xdr_compat.o -llammpscuda -lgpu -lcolvars -lfftw3 -ljpeg -lpng -lcuda -lcudart -lcudart -lcuda -ldl -o …/lmp_ubuntu
fft3d_cuda.o: In function fft_3d_cuda(FFT_DATA*, FFT_DATA*, int, fft_plan_3d*)': /home/kam/lammps-5Sep14/src/Obj_ubuntu/../fft3d_cuda.cpp:132: undefined reference to cufftExecC2C’
/home/kam/lammps-5Sep14/src/Obj_ubuntu/…/fft3d_cuda.cpp:128: undefined reference to cufftExecC2C' fft3d_cuda.o: In function fft_3d_create_plan_cuda(ompi_communicator_t*, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int*, bool)’:
/home/kam/lammps-5Sep14/src/Obj_ubuntu/…/fft3d_cuda.cpp:439: undefined reference to cufftPlan3d' fft3d_cuda.o: In function fft_3d_destroy_plan_cuda(fft_plan_3d*)’:
/home/kam/lammps-5Sep14/src/Obj_ubuntu/…/fft3d_cuda.cpp:479: undefined reference to cufftDestroy' fft3d_cuda.o: In function fft_1d_only_cuda(FFT_DATA*, int, int, fft_plan_3d*)’:
/home/kam/lammps-5Sep14/src/Obj_ubuntu/…/fft3d_cuda.cpp:593: undefined reference to cufftExecC2C' collect2: error: ld returned 1 exit status make[1]: *** [../lmp_ubuntu] Error 1 make[1]: Leaving directory /home/kam/lammps-5Sep14/src/Obj_ubuntu’
make: *** [ubuntu] Error 2

Just wondering if anyone has been able to overcome this issue or has suggestions on how to overcome.

Hi all,

We've recently added some high performance workstations to our office so
I've been trying to compile Lammps with CUDA on Ubuntu 13.10 OS. I've been
able to compile a normal lammps install with no additional packages, however
similar to http://lammps.sandia.gov/threads/msg31386.html I cannot compile
with CUDA.

I've installed the CUDA library, and pointed to it in all the cuda files,
however when compiling I get the following error:

mpic++ -g -O3 -L../../lib/cuda -L../../lib/gpu -L../../lib/colvars
-L/usr/local/cuda/lib -L/usr/local/cuda/lib64 -lcufft
-L/usr/local/cuda/lib64 angle_charmm.o angle_class2.o angle_cosine.o
angle_cosine_delta.o angle_cosine_periodic.o angle_cosine_shift.o

[...]

respa.o run.o set.o special.o tad.o temper.o thermo.o timer.o universe.o
update.o variable.o velocity.o verlet.o verlet_cuda.o verlet_split.o
write_data.o write_dump.o write_restart.o xdr_compat.o -llammpscuda -lgpu
-lcolvars -lfftw3 -ljpeg -lpng -lcuda -lcudart -lcudart -lcuda -ldl -o
../lmp_ubuntu
fft3d_cuda.o: In function `fft_3d_cuda(FFT_DATA*, FFT_DATA*, int,
fft_plan_3d*)':
/home/kam/lammps-5Sep14/src/Obj_ubuntu/../fft3d_cuda.cpp:132: undefined
reference to `cufftExecC2C'
/home/kam/lammps-5Sep14/src/Obj_ubuntu/../fft3d_cuda.cpp:128: undefined
reference to `cufftExecC2C'
fft3d_cuda.o: In function `fft_3d_create_plan_cuda(ompi_communicator_t*,
int, int, int, int, int, int, int, int, int, int, int, int, int, int, int,
int, int, int*, bool)':
/home/kam/lammps-5Sep14/src/Obj_ubuntu/../fft3d_cuda.cpp:439: undefined
reference to `cufftPlan3d'
fft3d_cuda.o: In function `fft_3d_destroy_plan_cuda(fft_plan_3d*)':
/home/kam/lammps-5Sep14/src/Obj_ubuntu/../fft3d_cuda.cpp:479: undefined
reference to `cufftDestroy'
fft3d_cuda.o: In function `fft_1d_only_cuda(FFT_DATA*, int, int,
fft_plan_3d*)':
/home/kam/lammps-5Sep14/src/Obj_ubuntu/../fft3d_cuda.cpp:593: undefined
reference to `cufftExecC2C'
collect2: error: ld returned 1 exit status
make[1]: *** [../lmp_ubuntu] Error 1
make[1]: Leaving directory `/home/kam/lammps-5Sep14/src/Obj_ubuntu'
make: *** [ubuntu] Error 2

Just wondering if anyone has been able to overcome this issue or has
suggestions on how to overcome.

you have placed -lcufft in the wrong makefile variable in
Makefile.lammps. it has to be where -lcuda and -lcudart are (and come
*before* them).

axel.

Thanks Axel, this has solved the problem. Not sure if it is worth addressing, but the /lib/cuda Makefile.lammps was created with make precision=1 arch=35 prec_timer=1 cufft=1. It puts:

CUDA_USRLIB_CONDITIONAL := -L/usr/local/cuda/lib -L/usr/local/cuda/lib64 -lcufft
user-cuda_SYSLIB = -lcuda -lcudart

rather than:

CUDA_USRLIB_CONDITIONAL := -L/usr/local/cuda/lib -L/usr/local/cuda/lib64
user-cuda_SYSLIB = -lcufft -lcuda -lcudart

Cheers,

Kamron

Changed it to what you suggested, which makes more sense to me as well.

Steve

a better choice would be:

user-cuda_SYSINC = \{CUDA\_FLAGS\} user\-cuda\_SYSLIB = (CUDA_USRLIB_CONDITIONAL) -lcuda -lcudart
user-cuda_SYSPATH =

The LAMMPS convention is to put the lib paths in SYSPATH and the libs
themselves in SYSLIB. The link line strings them together in
the correct order.

Steve