@@ -471,34 +471,19 @@ def configure_step(self, **kwargs):
471471 # https://docs.lammps.org/Build_basics.html
472472 # https://docs.lammps.org/Build_settings.html
473473 # https://docs.lammps.org/Build_package.html
474+ # https://docs.lammps.org/Build_extras.html
474475 if self .cfg ['general_packages' ]:
475476 for package in self .cfg ['general_packages' ]:
476477 self .cfg .update ('configopts' , '-D%s%s=on' % (self .pkg_prefix , package ))
477478
478479 if self .cfg ['user_packages' ]:
479480 for package in self .cfg ['user_packages' ]:
480481 self .cfg .update ('configopts' , '-D%s%s=on' % (self .pkg_user_prefix , package ))
481-
482- # Optimization settings
482+ # OPT package
483483 pkg_opt = '-D%sOPT=' % self .pkg_prefix
484484 if pkg_opt not in self .cfg ['configopts' ]:
485485 self .cfg .update ('configopts' , pkg_opt + 'on' )
486486
487- # grab the architecture so we can check if we have Intel hardware (also used for Kokkos below)
488- processor_arch , gpu_arch = self .get_kokkos_arch (cuda_cc , self .cfg ['kokkos_arch' ])
489-
490- self .pkg_intel = False
491- if processor_arch in INTEL_PACKAGE_ARCH_LIST or \
492- (processor_arch == 'NATIVE' and self .kokkos_cpu_mapping .get (get_cpu_arch ()) in INTEL_PACKAGE_ARCH_LIST ):
493- # USER-INTEL enables optimizations on Intel processors. GCC has also partial support for some of them.
494- pkg_user_intel = '-D%sINTEL=' % self .pkg_user_prefix
495- if pkg_user_intel not in self .cfg ['configopts' ]:
496- if self .toolchain .comp_family () in [toolchain .GCC , toolchain .INTELCOMP ]:
497- self .cfg .update ('configopts' , pkg_user_intel + 'on' )
498- self .pkg_intel = True
499- else :
500- self .pkg_intel = True
501-
502487 # MPI/OpenMP
503488 if self .toolchain .options .get ('usempi' , None ):
504489 self .cfg .update ('configopts' , '-DBUILD_MPI=yes' )
@@ -521,8 +506,23 @@ def configure_step(self, **kwargs):
521506 if '-DFFT_PACK=' not in self .cfg ['configopts' ]:
522507 self .cfg .update ('configopts' , '-DFFT_PACK=array' )
523508
524- # https://lammps.sandia.gov/doc/Build_extras.html
525- # KOKKOS
509+ # detect the CPU and GPU architecture (used for Intel and Kokkos packages belos)
510+ processor_arch , gpu_arch = self .get_kokkos_arch (cuda_cc , self .cfg ['kokkos_arch' ])
511+
512+ # INTEL package
513+ self .pkg_intel = False
514+ if processor_arch in INTEL_PACKAGE_ARCH_LIST or \
515+ (processor_arch == 'NATIVE' and self .kokkos_cpu_mapping .get (get_cpu_arch ()) in INTEL_PACKAGE_ARCH_LIST ):
516+ # USER-INTEL enables optimizations on Intel processors. GCC has also partial support for some of them.
517+ pkg_user_intel = '-D%sINTEL=' % self .pkg_user_prefix
518+ if pkg_user_intel not in self .cfg ['configopts' ]:
519+ if self .toolchain .comp_family () in [toolchain .GCC , toolchain .INTELCOMP ]:
520+ self .cfg .update ('configopts' , pkg_user_intel + 'on' )
521+ self .pkg_intel = True
522+ else :
523+ self .pkg_intel = True
524+
525+ # KOKKOS package
526526 if self .cfg ['kokkos' ]:
527527 print_msg ("Using Kokkos package with arch: CPU - %s, GPU - %s" % (processor_arch , gpu_arch ))
528528 self .cfg .update ('configopts' , '-D%sKOKKOS=on' % self .pkg_prefix )
@@ -562,7 +562,7 @@ def configure_step(self, **kwargs):
562562 elif get_software_root ("FFTW" ):
563563 self .cfg .update ('configopts' , '-DFFT_KOKKOS=FFTW3' )
564564
565- # CUDA only
565+ # GPU package (cannot be built with KOKKOS+CUDA)
566566 elif self .cuda :
567567 print_msg ("Using GPU package (not Kokkos) with arch: CPU - %s, GPU - %s" % (processor_arch , gpu_arch ))
568568 self .cfg .update ('configopts' , '-D%sGPU=on' % self .pkg_prefix )
@@ -573,6 +573,7 @@ def configure_step(self, **kwargs):
573573 # to lib64)
574574 self .cfg .update ('configopts' , '-DCMAKE_INSTALL_LIBDIR=lib' )
575575
576+ # Python interface
576577 # avoid that pip (ab)uses $HOME/.cache/pip
577578 # cfr. https://pip.pypa.io/en/stable/reference/pip_install/#caching
578579 env .setvar ('XDG_CACHE_HOME' , tempfile .gettempdir ())
@@ -613,7 +614,7 @@ def configure_step(self, **kwargs):
613614 # Testing of KOKKOS+CUDA builds does not work for version < 22Jul2025
614615 # See: https://github.com/lammps/lammps/issues/405
615616 if LooseVersion (self .cur_version ) < LooseVersion (translate_lammps_version ('22Jul2025' )) \
616- and self .cfg ['kokkos' ] and self .cuda :
617+ and self .cfg ['kokkos' ] and self .cuda :
617618 print_warning ("Skipping tests: KOKKOS+CUDA builds have broken testing in LAMMPS < 22Jul2025." )
618619 self .cfg ['runtest' ] = False
619620 else :
@@ -713,6 +714,11 @@ def sanity_check_step(self, *args, **kwargs):
713714 ]
714715
715716 # add accelerator-specific tests
717+ if self .pkg_intel : # INTEL package
718+ custom_commands .append (
719+ 'from lammps import lammps; l=lammps(cmdargs=["-sf", "intel"]); l.file("%s")' %
720+ os .path .join (self .installdir , "examples" , "msst" , "in.msst" )
721+ )
716722 if self .cfg ['kokkos' ]: # KOKKOS package
717723 if self .cuda : # NOTE: requires a GPU to run
718724 custom_commands .append (
@@ -725,21 +731,20 @@ def sanity_check_step(self, *args, **kwargs):
725731 os .path .join (self .installdir , "examples" , "msst" , "in.msst" )
726732 )
727733 elif self .cuda : # GPU package
728- if self .cuda : # NOTE: requires a GPU to run
729- custom_commands .append (
730- 'from lammps import lammps; l=lammps(cmdargs=["-sf", "gpu", "-pk", "gpu", "1"]); l.file("%s")' %
731- os .path .join (self .installdir , "examples" , "msst" , "in.msst" )
732- )
733- if self .pkg_intel : # INTEL package
734734 custom_commands .append (
735- 'from lammps import lammps; l=lammps(cmdargs=["-sf", "intel "]); l.file("%s")' %
735+ 'from lammps import lammps; l=lammps(cmdargs=["-sf", "gpu", "-pk", "gpu", "1 "]); l.file("%s")' %
736736 os .path .join (self .installdir , "examples" , "msst" , "in.msst" )
737737 )
738738 if self .toolchain .options .get ('openmp' , None ): # OPENMP package
739739 custom_commands .append (
740740 'from lammps import lammps; l=lammps(cmdargs=["-sf", "omp", "-pk", "omp", "2"]); l.file("%s")' %
741741 os .path .join (self .installdir , "examples" , "msst" , "in.msst" )
742742 )
743+ # OPT package
744+ custom_commands .append (
745+ 'from lammps import lammps; l=lammps(cmdargs=["-sf", "opt"]); l.file("%s")' %
746+ os .path .join (self .installdir , "examples" , "msst" , "in.msst" )
747+ )
743748
744749 # mpirun command needs an l.finalize() in the sanity check from LAMMPS 29Sep2021
745750 # This is actually not needed if mpi4py is installed, and can cause a crash in version 2025+
0 commit comments