diff --git a/cmake/Modules/Packages/COMPRESS.cmake b/cmake/Modules/Packages/COMPRESS.cmake index c92767692a..4d392ab516 100644 --- a/cmake/Modules/Packages/COMPRESS.cmake +++ b/cmake/Modules/Packages/COMPRESS.cmake @@ -1,5 +1,9 @@ find_package(ZLIB REQUIRED) target_link_libraries(lammps PRIVATE ZLIB::ZLIB) -find_package(Zstd REQUIRED) -target_link_libraries(lammps PRIVATE Zstd::Zstd) +find_package(Zstd) + +if(Zstd_FOUND) + target_compile_definitions(lammps PRIVATE -DLAMMPS_ZSTD) + target_link_libraries(lammps PRIVATE Zstd::Zstd) +endif() diff --git a/src/COMPRESS/README b/src/COMPRESS/README index 1a31445d0b..617757c476 100644 --- a/src/COMPRESS/README +++ b/src/COMPRESS/README @@ -10,5 +10,9 @@ alternative for compressed file I/O on systems where using a pipe can cause problems, e.g. when using RDMA communication with pinned memory like clusters with Infiniband or Myrinet. +Update 08/2020: Added variants that use the Zstd compression library instead +of zlib. To enable, set -DLAMMPS_ZSTD. These provide a wider range of +compression levels. See http://facebook.github.io/zstd/ for more details. + Currently a few selected dump styles are supported for writing via this packaging. diff --git a/src/COMPRESS/dump_atom_zstd.cpp b/src/COMPRESS/dump_atom_zstd.cpp index 30862ab854..c3085a3b56 100644 --- a/src/COMPRESS/dump_atom_zstd.cpp +++ b/src/COMPRESS/dump_atom_zstd.cpp @@ -15,6 +15,8 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD + #include "dump_atom_zstd.h" #include "domain.h" #include "error.h" @@ -189,3 +191,5 @@ int DumpAtomZstd::modify_param(int narg, char **arg) } return consumed; } + +#endif diff --git a/src/COMPRESS/dump_atom_zstd.h b/src/COMPRESS/dump_atom_zstd.h index d1bfd9d00f..30108eeee9 100644 --- a/src/COMPRESS/dump_atom_zstd.h +++ b/src/COMPRESS/dump_atom_zstd.h @@ -15,6 +15,8 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD + #ifdef DUMP_CLASS DumpStyle(atom/zstd,DumpAtomZstd) @@ -47,6 +49,7 @@ class DumpAtomZstd : public DumpAtom { } +#endif #endif #endif diff --git a/src/COMPRESS/dump_cfg_zstd.cpp b/src/COMPRESS/dump_cfg_zstd.cpp index 2b683b4861..f153484164 100644 --- a/src/COMPRESS/dump_cfg_zstd.cpp +++ b/src/COMPRESS/dump_cfg_zstd.cpp @@ -15,6 +15,7 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD #include "dump_cfg_zstd.h" #include "atom.h" #include "domain.h" @@ -192,3 +193,4 @@ int DumpCFGZstd::modify_param(int narg, char **arg) } return consumed; } +#endif diff --git a/src/COMPRESS/dump_cfg_zstd.h b/src/COMPRESS/dump_cfg_zstd.h index 653ff6a776..6f4fe8face 100644 --- a/src/COMPRESS/dump_cfg_zstd.h +++ b/src/COMPRESS/dump_cfg_zstd.h @@ -15,6 +15,7 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD #ifdef DUMP_CLASS DumpStyle(cfg/zstd,DumpCFGZstd) @@ -47,6 +48,7 @@ class DumpCFGZstd : public DumpCFG { } +#endif #endif #endif diff --git a/src/COMPRESS/dump_custom_zstd.cpp b/src/COMPRESS/dump_custom_zstd.cpp index 420425b050..d3bf3467eb 100644 --- a/src/COMPRESS/dump_custom_zstd.cpp +++ b/src/COMPRESS/dump_custom_zstd.cpp @@ -15,6 +15,8 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD + #include "dump_custom_zstd.h" #include "domain.h" #include "error.h" @@ -189,3 +191,5 @@ int DumpCustomZstd::modify_param(int narg, char **arg) } return consumed; } + +#endif diff --git a/src/COMPRESS/dump_custom_zstd.h b/src/COMPRESS/dump_custom_zstd.h index fbda89d490..ce3f1325c5 100644 --- a/src/COMPRESS/dump_custom_zstd.h +++ b/src/COMPRESS/dump_custom_zstd.h @@ -15,6 +15,8 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD + #ifdef DUMP_CLASS DumpStyle(custom/zstd,DumpCustomZstd) @@ -48,6 +50,7 @@ class DumpCustomZstd : public DumpCustom { } +#endif #endif #endif diff --git a/src/COMPRESS/dump_local_zstd.cpp b/src/COMPRESS/dump_local_zstd.cpp index 643e29f2cc..73402bee47 100644 --- a/src/COMPRESS/dump_local_zstd.cpp +++ b/src/COMPRESS/dump_local_zstd.cpp @@ -15,6 +15,8 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD + #include "dump_local_zstd.h" #include "domain.h" #include "error.h" @@ -189,3 +191,5 @@ int DumpLocalZstd::modify_param(int narg, char **arg) } return consumed; } + +#endif diff --git a/src/COMPRESS/dump_local_zstd.h b/src/COMPRESS/dump_local_zstd.h index 5f3ddb84f2..398b1c3337 100644 --- a/src/COMPRESS/dump_local_zstd.h +++ b/src/COMPRESS/dump_local_zstd.h @@ -15,6 +15,8 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD + #ifdef DUMP_CLASS DumpStyle(local/zstd,DumpLocalZstd) @@ -47,6 +49,7 @@ class DumpLocalZstd : public DumpLocal { } +#endif #endif #endif diff --git a/src/COMPRESS/dump_xyz_zstd.cpp b/src/COMPRESS/dump_xyz_zstd.cpp index e825051474..fb65af63e5 100644 --- a/src/COMPRESS/dump_xyz_zstd.cpp +++ b/src/COMPRESS/dump_xyz_zstd.cpp @@ -15,6 +15,8 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD + #include "dump_xyz_zstd.h" #include "error.h" #include "update.h" @@ -164,3 +166,5 @@ int DumpXYZZstd::modify_param(int narg, char **arg) } return consumed; } + +#endif diff --git a/src/COMPRESS/dump_xyz_zstd.h b/src/COMPRESS/dump_xyz_zstd.h index e1991202d6..2422341557 100644 --- a/src/COMPRESS/dump_xyz_zstd.h +++ b/src/COMPRESS/dump_xyz_zstd.h @@ -15,6 +15,8 @@ Contributing author: Richard Berger (Temple U) ------------------------------------------------------------------------- */ +#ifdef LAMMPS_ZSTD + #ifdef DUMP_CLASS DumpStyle(xyz/zstd,DumpXYZZstd) @@ -47,6 +49,7 @@ class DumpXYZZstd : public DumpXYZ { } +#endif #endif #endif