Unverified Commit daac3f71 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1419 from akohlmey/report-uninstalled-pkg-style

Improved error messages when a style is not found
parents 3bf0a4ba db74f14f
Loading
Loading
Loading
Loading
+20 −24
Original line number Diff line number Diff line
@@ -87,7 +87,8 @@ string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE)
# this is fast, so check for it all the time
message(STATUS "Running check for auto-generated files from make-based build system")
file(GLOB SRC_AUTOGEN_FILES ${LAMMPS_SOURCE_DIR}/style_*.h)
list(APPEND SRC_AUTOGEN_FILES ${LAMMPS_SOURCE_DIR}/lmpinstalledpkgs.h ${LAMMPS_SOURCE_DIR}/lmpgitversion.h)
file(GLOB SRC_AUTOGEN_PACKAGES ${LAMMPS_SOURCE_DIR}/packages_*.h)
list(APPEND SRC_AUTOGEN_FILES ${SRC_AUTOGEN_PACKAGES} ${LAMMPS_SOURCE_DIR}/lmpinstalledpkgs.h ${LAMMPS_SOURCE_DIR}/lmpgitversion.h)
foreach(_SRC ${SRC_AUTOGEN_FILES})
  get_filename_component(FILENAME "${_SRC}" NAME)
  if(EXISTS ${LAMMPS_SOURCE_DIR}/${FILENAME})
@@ -172,21 +173,17 @@ set(LAMMPS_LINK_LIBS)
set(LAMMPS_DEPS)
set(LAMMPS_API_DEFINES)

set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE GRANULAR
  KSPACE MANYBODY MC MESSAGE MISC MOLECULE PERI REPLICA RIGID SHOCK
  SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI POEMS LATTE USER-ATC USER-AWPMD
  USER-BOCS USER-CGDNA USER-MESO USER-CGSDK USER-COLVARS USER-DIFFRACTION
  USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD
  USER-MEAMC USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF
  USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REAXC USER-SCAFACOS
  USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-VTK
  USER-QUIP USER-QMMM USER-YAFF USER-ADIOS)
set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE
  GRANULAR KSPACE LATTE MANYBODY MC MESSAGE MISC MOLECULE PERI POEMS QEQ
  REPLICA RIGID SHOCK SPIN SNAP SRD KIM PYTHON MSCG MPIIO VORONOI
  USER-ATC USER-AWPMD USER-BOCS USER-CGDNA USER-MESO USER-CGSDK USER-COLVARS
  USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB
  USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE
  USER-NETCDF USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REAXC
  USER-SCAFACOS USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF
  USER-VTK USER-QUIP USER-QMMM USER-YAFF USER-ADIOS)
set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU)
set(OTHER_PACKAGES CORESHELL QEQ)
foreach(PKG ${DEFAULT_PACKAGES})
  option(PKG_${PKG} "Build ${PKG} Package" OFF)
endforeach()
foreach(PKG ${ACCEL_PACKAGES} ${OTHER_PACKAGES})
foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES})
  option(PKG_${PKG} "Build ${PKG} Package" OFF)
endforeach()

@@ -203,7 +200,6 @@ endif()

include_directories(${LAMMPS_SOURCE_DIR})


if(PKG_USER-ADIOS)
  # The search for ADIOS2 must come before MPI because
  # it includes its own MPI search with the latest FindMPI.cmake
@@ -213,7 +209,6 @@ if(PKG_USER-ADIOS)
  list(APPEND LAMMPS_LINK_LIBS adios2::adios2)
endif()


# do MPI detection after language activation, if MPI for these language is required
find_package(MPI QUIET)
option(BUILD_MPI "Build MPI version" ${MPI_FOUND})
@@ -233,7 +228,6 @@ else()
  list(APPEND LAMMPS_LINK_LIBS mpi_stubs)
endif()


set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
@@ -446,7 +440,6 @@ else()
  set(CUDA_REQUEST_PIC)
endif()


if(PKG_VORONOI)
  find_package(VORO)
  if(VORO_FOUND)
@@ -895,6 +888,8 @@ foreach(PKG ${DEFAULT_PACKAGES})
    list(APPEND LIB_SOURCES ${${PKG}_SOURCES})
    include_directories(${${PKG}_SOURCES_DIR})
  endif()

  RegisterPackages(${${PKG}_SOURCES_DIR})
endforeach()

# packages that need defines set
@@ -913,6 +908,8 @@ foreach(PKG ${ACCEL_PACKAGES})

  # check for package files in src directory due to old make system
  DetectBuildSystemConflict(${LAMMPS_SOURCE_DIR} ${${PKG}_SOURCES} ${${PKG}_HEADERS})

  RegisterPackages(${${PKG}_SOURCES_DIR})
endforeach()

##############################################
@@ -961,7 +958,6 @@ if(PKG_USER-H5MD)
  include_directories(${HDF5_INCLUDE_DIRS})
endif()


######################################################################
# packages which selectively include variants based on enabled styles
# e.g. accelerator packages
@@ -1438,10 +1434,12 @@ endif()
######################################################
# Generate style headers based on global list of
# styles registered during package selection
# Generate packages headers from all packages
######################################################
set(LAMMPS_STYLE_HEADERS_DIR ${CMAKE_CURRENT_BINARY_DIR}/styles)

GenerateStyleHeaders(${LAMMPS_STYLE_HEADERS_DIR})
GeneratePackagesHeaders(${LAMMPS_STYLE_HEADERS_DIR})

include_directories(${LAMMPS_STYLE_HEADERS_DIR})

@@ -1450,7 +1448,7 @@ include_directories(${LAMMPS_STYLE_HEADERS_DIR})
######################################
set(temp "#ifndef LMP_INSTALLED_PKGS_H\n#define LMP_INSTALLED_PKGS_H\n")
set(temp "${temp}const char * LAMMPS_NS::LAMMPS::installed_packages[] =  {\n")
set(temp_PKG_LIST ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES} ${OTHER_PACKAGES})
set(temp_PKG_LIST ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES})
list(SORT temp_PKG_LIST)
foreach(PKG ${temp_PKG_LIST})
    if(PKG_${PKG})
@@ -1529,8 +1527,6 @@ if(BUILD_EXE)

endif()



###############################################################################
# Build documentation
###############################################################################
@@ -1683,7 +1679,7 @@ endif()
###############################################################################
# Print package summary
###############################################################################
foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES} ${OTHER_PACKAGES})
foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES})
  if(PKG_${PKG})
    message(STATUS "Building package: ${PKG}")
  endif()
+85 −0
Original line number Diff line number Diff line
@@ -181,3 +181,88 @@ function(DetectBuildSystemConflict lammps_src_dir)
    endforeach()
  endif()
endfunction(DetectBuildSystemConflict)


function(FindPackagesHeaders path style_class file_pattern headers)
    file(GLOB files "${path}/${file_pattern}*.h")
    get_property(plist GLOBAL PROPERTY ${headers})

    foreach(file_name ${files})
        file(STRINGS ${file_name} is_style LIMIT_COUNT 1 REGEX ${style_class})
        if(is_style)
            list(APPEND plist ${file_name})
        endif()
    endforeach()
    set_property(GLOBAL PROPERTY ${headers} "${plist}")
endfunction(FindPackagesHeaders)

function(RegisterPackages search_path)
    FindPackagesHeaders(${search_path} ANGLE_CLASS     angle_     PKGANGLE     ) # angle     ) # force
    FindPackagesHeaders(${search_path} ATOM_CLASS      atom_vec_  PKGATOM_VEC  ) # atom      ) # atom      atom_vec_hybrid
    FindPackagesHeaders(${search_path} BODY_CLASS      body_      PKGBODY      ) # body      ) # atom_vec_body
    FindPackagesHeaders(${search_path} BOND_CLASS      bond_      PKGBOND      ) # bond      ) # force
    FindPackagesHeaders(${search_path} COMMAND_CLASS   "[^.]"     PKGCOMMAND   ) # command   ) # input
    FindPackagesHeaders(${search_path} COMPUTE_CLASS   compute_   PKGCOMPUTE   ) # compute   ) # modify
    FindPackagesHeaders(${search_path} DIHEDRAL_CLASS  dihedral_  PKGDIHEDRAL  ) # dihedral  ) # force
    FindPackagesHeaders(${search_path} DUMP_CLASS      dump_      PKGDUMP      ) # dump      ) # output    write_dump
    FindPackagesHeaders(${search_path} FIX_CLASS       fix_       PKGFIX       ) # fix       ) # modify
    FindPackagesHeaders(${search_path} IMPROPER_CLASS  improper_  PKGIMPROPER  ) # improper  ) # force
    FindPackagesHeaders(${search_path} INTEGRATE_CLASS "[^.]"     PKGINTEGRATE ) # integrate ) # update
    FindPackagesHeaders(${search_path} KSPACE_CLASS    "[^.]"     PKGKSPACE    ) # kspace    ) # force
    FindPackagesHeaders(${search_path} MINIMIZE_CLASS  min_       PKGMINIMIZE  ) # minimize  ) # update
    FindPackagesHeaders(${search_path} NBIN_CLASS      nbin_      PKGNBIN      ) # nbin      ) # neighbor
    FindPackagesHeaders(${search_path} NPAIR_CLASS     npair_     PKGNPAIR     ) # npair     ) # neighbor
    FindPackagesHeaders(${search_path} NSTENCIL_CLASS  nstencil_  PKGNSTENCIL  ) # nstencil  ) # neighbor
    FindPackagesHeaders(${search_path} NTOPO_CLASS     ntopo_     PKGNTOPO     ) # ntopo     ) # neighbor
    FindPackagesHeaders(${search_path} PAIR_CLASS      pair_      PKGPAIR      ) # pair      ) # force
    FindPackagesHeaders(${search_path} READER_CLASS    reader_    PKGREADER    ) # reader    ) # read_dump
    FindPackagesHeaders(${search_path} REGION_CLASS    region_    PKGREGION    ) # region    ) # domain
endfunction(RegisterPackages)

function(CreatePackagesHeader path filename)
  set(temp "")
  if(ARGC GREATER 2)
    list(REMOVE_AT ARGV 0 1)
    foreach(FNAME ${ARGV})
      set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${FNAME}")
      get_filename_component(DNAME ${FNAME} DIRECTORY)
      get_filename_component(DNAME ${DNAME} NAME)
      get_filename_component(FNAME ${FNAME} NAME)
      set(temp "${temp}#undef PACKAGE\n#define PACKAGE \"${DNAME}\"\n")
      set(temp "${temp}#include \"${DNAME}/${FNAME}\"\n")
    endforeach()
  endif()
  message(STATUS "Generating ${filename}...")
  file(WRITE "${path}/${filename}.tmp" "${temp}" )
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${path}/${filename}.tmp" "${path}/${filename}")
  set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${path}/${filename}")
endfunction(CreatePackagesHeader)

function(GeneratePackagesHeader path property style)
  get_property(files GLOBAL PROPERTY ${property})
  CreatePackagesHeader("${path}" "packages_${style}.h" ${files})
endfunction(GeneratePackagesHeader)

function(GeneratePackagesHeaders output_path)
    GeneratePackagesHeader(${output_path} PKGANGLE      angle     ) # force
    GeneratePackagesHeader(${output_path} PKGATOM_VEC   atom      ) # atom      atom_vec_hybrid
    GeneratePackagesHeader(${output_path} PKGBODY       body      ) # atom_vec_body
    GeneratePackagesHeader(${output_path} PKGBOND       bond      ) # force
    GeneratePackagesHeader(${output_path} PKGCOMMAND    command   ) # input
    GeneratePackagesHeader(${output_path} PKGCOMPUTE    compute   ) # modify
    GeneratePackagesHeader(${output_path} PKGDIHEDRAL   dihedral  ) # force
    GeneratePackagesHeader(${output_path} PKGDUMP       dump      ) # output    write_dump
    GeneratePackagesHeader(${output_path} PKGFIX        fix       ) # modify
    GeneratePackagesHeader(${output_path} PKGIMPROPER   improper  ) # force
    GeneratePackagesHeader(${output_path} PKGINTEGRATE  integrate ) # update
    GeneratePackagesHeader(${output_path} PKGKSPACE     kspace    ) # force
    GeneratePackagesHeader(${output_path} PKGMINIMIZE   minimize  ) # update
    GeneratePackagesHeader(${output_path} PKGNBIN       nbin      ) # neighbor
    GeneratePackagesHeader(${output_path} PKGNPAIR      npair     ) # neighbor
    GeneratePackagesHeader(${output_path} PKGNSTENCIL   nstencil  ) # neighbor
    GeneratePackagesHeader(${output_path} PKGNTOPO      ntopo     ) # neighbor
    GeneratePackagesHeader(${output_path} PKGPAIR       pair      ) # force
    GeneratePackagesHeader(${output_path} PKGREADER     reader    ) # read_dump
    GeneratePackagesHeader(${output_path} PKGREGION     region    ) # domain
endfunction(GeneratePackagesHeaders)
+19 −14
Original line number Diff line number Diff line
@@ -7448,6 +7448,11 @@ The Atoms section of a data file must come before a Triangles section. :dd
The Atoms section of a data file must come before a Velocities
section. :dd

{Must re-specify non-restarted pair style (xxx) after read_restart} :dt

For pair styles, that do not store their settings in a restart file,
it must be defined with a new 'pair_style' command after read_restart. :dd

{Must set both respa inner and outer} :dt

Cannot use just the inner or outer option with respa without using the
@@ -10049,19 +10054,19 @@ create_box command. :dd
A universe or uloop style variable must specify a number of values >= to the
number of processor partitions. :dd

{Unknown angle style} :dt
{Unrecognized angle style} :dt

The choice of angle style is unknown. :dd

{Unknown atom style} :dt
{Unrecognized atom style} :dt

The choice of atom style is unknown. :dd

{Unknown body style} :dt
{Unrecognized body style} :dt

The choice of body style is unknown. :dd

{Unknown bond style} :dt
{Unrecognized bond style} :dt

The choice of bond style is unknown. :dd

@@ -10077,23 +10082,23 @@ Self-explanatory. :dd

Self-explanatory. :dd

{Unknown command: %s} :dt
{Unrecognized command: %s} :dt

The command is not known to LAMMPS.  Check the input script. :dd

{Unknown compute style} :dt
{Unrecognized compute style} :dt

The choice of compute style is unknown. :dd

{Unknown dihedral style} :dt
{Unrecognized dihedral style} :dt

The choice of dihedral style is unknown. :dd

{Unknown dump reader style} :dt
{Unrecognized dump reader style} :dt

The choice of dump reader style via the format keyword is unknown. :dd

{Unknown dump style} :dt
{Unrecognized dump style} :dt

The choice of dump style is unknown. :dd

@@ -10101,7 +10106,7 @@ The choice of dump style is unknown. :dd

Self-explanatory. :dd

{Unknown fix style} :dt
{Unrecognized fix style} :dt

The choice of fix style is unknown. :dd

@@ -10109,7 +10114,7 @@ The choice of fix style is unknown. :dd

A section of the data file cannot be read by LAMMPS. :dd

{Unknown improper style} :dt
{Unrecognized improper style} :dt

The choice of improper style is unknown. :dd

@@ -10117,7 +10122,7 @@ The choice of improper style is unknown. :dd

One or more specified keywords are not recognized. :dd

{Unknown kspace style} :dt
{Unrecognized kspace style} :dt

The choice of kspace style is unknown. :dd

@@ -10133,7 +10138,7 @@ Self-explanatory. :dd

Self-explanatory. :dd

{Unknown pair style} :dt
{Unrecognized pair style} :dt

The choice of pair style is unknown. :dd

@@ -10141,7 +10146,7 @@ The choice of pair style is unknown. :dd

The choice of sub-style is unknown. :dd

{Unknown region style} :dt
{Unrecognized region style} :dt

The choice of region style is unknown. :dd

+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
/lmp_*

/style_*.h
/packages_*.h
/lmpinstalledpkgs.h
/lmpgitversion.h

+52 −22
Original line number Diff line number Diff line
@@ -55,6 +55,34 @@ style () {
  fi
}

packages () {
  list=`grep -sl $1 */$2*.h`
  if (test -e packages_$3.tmp) then
    rm -f packages_$3.tmp
  fi
  for file in $list; do
    dir="\"`dirname $file`\""
    echo "#undef PACKAGE" >> packages_$3.tmp
    echo "#define PACKAGE $dir" >> packages_$3.tmp
    qfile="\"$file\""
    echo "#include $qfile" >> packages_$3.tmp
  done
  if (test ! -e packages_$3.tmp) then
    if (test ! -e packages_$3.h) then
      touch packages_$3.h
    elif (test "`cat packages_$3.h`" != "") then
      rm -f packages_$3.h
      touch packages_$3.h
    fi
  elif (test ! -e packages_$3.h) then
    mv packages_$3.tmp packages_$3.h
  elif (test "`diff --brief packages_$3.h packages_$3.tmp`" != "") then
    mv packages_$3.tmp packages_$3.h
  else
    rm -f packages_$3.tmp
  fi
}

# create individual style files
# called by "make machine"
# col 1 = string to search for
@@ -63,28 +91,30 @@ style () {
# col 4 = file that includes the style file
# col 5 = optional 2nd file that includes the style file

if (test $1 = "style") then

  style ANGLE_CLASS     angle_      angle      force
  style ATOM_CLASS      atom_vec_   atom       atom      atom_vec_hybrid
  style BODY_CLASS      body_       body       atom_vec_body
  style BOND_CLASS      bond_       bond       force
  style COMMAND_CLASS   ""          command    input
  style COMPUTE_CLASS   compute_    compute    modify
  style DIHEDRAL_CLASS  dihedral_   dihedral   force
  style DUMP_CLASS      dump_       dump       output    write_dump
  style FIX_CLASS       fix_        fix        modify
  style IMPROPER_CLASS  improper_   improper   force
  style INTEGRATE_CLASS ""          integrate  update
  style KSPACE_CLASS    ""          kspace     force
  style MINIMIZE_CLASS  min_        minimize   update
  style NBIN_CLASS      nbin_       nbin       neighbor
  style NPAIR_CLASS     npair_      npair      neighbor
  style NSTENCIL_CLASS  nstencil_   nstencil   neighbor
  style NTOPO_CLASS     ntopo_      ntopo      neighbor
  style PAIR_CLASS      pair_       pair       force
  style READER_CLASS    reader_     reader     read_dump
  style REGION_CLASS    region_     region     domain
cmd=$1

if (test $cmd = "style") || (test $cmd = "packages") then

  $cmd ANGLE_CLASS     angle_      angle      force
  $cmd ATOM_CLASS      atom_vec_   atom       atom      atom_vec_hybrid
  $cmd BODY_CLASS      body_       body       atom_vec_body
  $cmd BOND_CLASS      bond_       bond       force
  $cmd COMMAND_CLASS   ""          command    input
  $cmd COMPUTE_CLASS   compute_    compute    modify
  $cmd DIHEDRAL_CLASS  dihedral_   dihedral   force
  $cmd DUMP_CLASS      dump_       dump       output    write_dump
  $cmd FIX_CLASS       fix_        fix        modify
  $cmd IMPROPER_CLASS  improper_   improper   force
  $cmd INTEGRATE_CLASS ""          integrate  update
  $cmd KSPACE_CLASS    ""          kspace     force
  $cmd MINIMIZE_CLASS  min_        minimize   update
  $cmd NBIN_CLASS      nbin_       nbin       neighbor
  $cmd NPAIR_CLASS     npair_      npair      neighbor
  $cmd NSTENCIL_CLASS  nstencil_   nstencil   neighbor
  $cmd NTOPO_CLASS     ntopo_      ntopo      neighbor
  $cmd PAIR_CLASS      pair_       pair       force
  $cmd READER_CLASS    reader_     reader     read_dump
  $cmd REGION_CLASS    region_     region     domain

# edit Makefile.lib, for creating non-shared lib
# called by "make makelib"
Loading