Merge branch 'develop' into lammps-gui-improvements

This commit is contained in:
Axel Kohlmeyer
2023-08-15 21:23:58 -04:00
10 changed files with 77 additions and 19 deletions

View File

@ -1,5 +1,7 @@
# Find clang-format # Find clang-format
find_program(ClangFormat_EXECUTABLE NAMES clang-format find_program(ClangFormat_EXECUTABLE NAMES clang-format
clang-format-17.0
clang-format-16.0
clang-format-15.0 clang-format-15.0
clang-format-14.0 clang-format-14.0
clang-format-13.0 clang-format-13.0
@ -19,7 +21,7 @@ if(ClangFormat_EXECUTABLE)
OUTPUT_VARIABLE clang_format_version OUTPUT_VARIABLE clang_format_version
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(clang_format_version MATCHES "^(Ubuntu |)clang-format version .*") if(clang_format_version MATCHES "^(Ubuntu |Debian |)clang-format version .*")
# Arch Linux output: # Arch Linux output:
# clang-format version 10.0.0 # clang-format version 10.0.0
# #
@ -32,9 +34,15 @@ if(ClangFormat_EXECUTABLE)
# Ubuntu 22.04 LTS output: # Ubuntu 22.04 LTS output:
# Ubuntu clang-format version 14.0.0-1ubuntu1 # Ubuntu clang-format version 14.0.0-1ubuntu1
# #
# Debian 11 output:
# Debian clang-format version 11.0.1-2
#
# Debian 12 output:
# Debian clang-format version 14.0.6
#
# Fedora 36 output: # Fedora 36 output:
# clang-format version 14.0.5 (Fedora 14.0.5-1.fc36) # clang-format version 14.0.5 (Fedora 14.0.5-1.fc36)
string(REGEX REPLACE "^(Ubuntu |)clang-format version ([0-9.]+).*" string(REGEX REPLACE "^(Ubuntu |Debian |)clang-format version ([0-9.]+).*"
"\\2" "\\2"
ClangFormat_VERSION ClangFormat_VERSION
"${clang_format_version}") "${clang_format_version}")

View File

@ -1,10 +1,10 @@
Using CMake with LAMMPS tutorial Using CMake with LAMMPS
================================ =======================
The support for building LAMMPS with CMake is a recent addition to The support for building LAMMPS with CMake is a recent addition to
LAMMPS thanks to the efforts of Christoph Junghans (LANL) and Richard LAMMPS thanks to the efforts of Christoph Junghans (LANL) and Richard
Berger (LANL). One of the key strengths of CMake is that it is not Berger (LANL). One of the key strengths of CMake is that it is not
tied to a specific platform or build system and thus it generates the tied to a specific platform or build system. Instead it generates the
files necessary to build and develop for different build systems and on files necessary to build and develop for different build systems and on
different platforms. Note, that this applies to the build system itself different platforms. Note, that this applies to the build system itself
not the LAMMPS code. In other words, without additional porting effort, not the LAMMPS code. In other words, without additional porting effort,
@ -32,7 +32,8 @@ program ``cmake`` (or ``cmake3``), a text mode interactive user
interface (TUI) program ``ccmake`` (or ``ccmake3``), or a graphical user interface (TUI) program ``ccmake`` (or ``ccmake3``), or a graphical user
interface (GUI) program ``cmake-gui``. All of them are portable interface (GUI) program ``cmake-gui``. All of them are portable
software available on all supported platforms and can be used software available on all supported platforms and can be used
interchangeably. The minimum required CMake version is 3.16. interchangeably. As of LAMMPS version 2 August 2023, the minimum
required CMake version is 3.16.
All details about features and settings for CMake are in the `CMake All details about features and settings for CMake are in the `CMake
online documentation <https://cmake.org/documentation/>`_. We focus online documentation <https://cmake.org/documentation/>`_. We focus

View File

@ -18,7 +18,7 @@ package was developed primarily by Christian Trott (Sandia) and Stan
Moore (Sandia) with contributions of various styles by others, Moore (Sandia) with contributions of various styles by others,
including Sikandar Mashayak (UIUC), Ray Shan (Sandia), and Dan Ibanez including Sikandar Mashayak (UIUC), Ray Shan (Sandia), and Dan Ibanez
(Sandia). For more information on developing using Kokkos abstractions (Sandia). For more information on developing using Kokkos abstractions
see the Kokkos `Wiki <https://github.com/kokkos/kokkos/wiki>`_. see the `Kokkos Wiki <https://github.com/kokkos/kokkos/wiki>`_.
Kokkos currently provides support for 4 modes of execution (per MPI Kokkos currently provides support for 4 modes of execution (per MPI
task). These are Serial (MPI-only for CPUs and Intel Phi), OpenMP task). These are Serial (MPI-only for CPUs and Intel Phi), OpenMP
@ -32,8 +32,9 @@ produce an executable compatible with a specific hardware.
Kokkos requires using a compiler that supports the c++17 standard. For Kokkos requires using a compiler that supports the c++17 standard. For
some compilers, it may be necessary to add a flag to enable c++17 support. some compilers, it may be necessary to add a flag to enable c++17 support.
For example, the GNU compiler uses the -std=c++17 flag. For a list of For example, the GNU compiler uses the -std=c++17 flag. For a list of
compilers that have been tested with the Kokkos library, see the Kokkos compilers that have been tested with the Kokkos library, see the
`Wiki <https://kokkos.github.io/kokkos-core-wiki/requirements.html>`_. `requirements document of the Kokkos Wiki
<https://kokkos.github.io/kokkos-core-wiki/requirements.html>`_.
.. admonition:: NVIDIA CUDA support .. admonition:: NVIDIA CUDA support
:class: note :class: note

View File

@ -301,9 +301,10 @@ __kernel void k_dpd_fast(const __global numtyp4 *restrict x_,
__local numtyp4 coeff[MAX_SHARED_TYPES*MAX_SHARED_TYPES]; __local numtyp4 coeff[MAX_SHARED_TYPES*MAX_SHARED_TYPES];
__local numtyp sp_lj[4]; __local numtyp sp_lj[4];
__local numtyp sp_sqrt[4]; __local numtyp sp_sqrt[4];
if (tid<4) if (tid<4) {
sp_lj[tid]=sp_lj_in[tid]; sp_lj[tid]=sp_lj_in[tid];
sp_sqrt[tid]=sp_sqrt_in[tid]; sp_sqrt[tid]=sp_sqrt_in[tid];
}
if (tid<MAX_SHARED_TYPES*MAX_SHARED_TYPES) { if (tid<MAX_SHARED_TYPES*MAX_SHARED_TYPES) {
coeff[tid]=coeff_in[tid]; coeff[tid]=coeff_in[tid];
} }

View File

@ -438,8 +438,8 @@ void ComputeGlobalAtom::compute_peratom()
} }
} }
} }
++m;
} }
++m;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -13,11 +13,12 @@
#include <cstring> // std::strlen #include <cstring> // std::strlen
#include <iterator> #include <iterator>
#include <limits> #include <limits>
#include <memory> // std::addressof
#include <string> #include <string>
#include <type_traits> #include <type_traits>
// The fmt library version in the form major * 10000 + minor * 100 + patch. // The fmt library version in the form major * 10000 + minor * 100 + patch.
#define FMT_VERSION 100001 #define FMT_VERSION 100100
#if defined(__clang__) && !defined(__ibmxl__) #if defined(__clang__) && !defined(__ibmxl__)
# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) # define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__)
@ -1290,9 +1291,9 @@ template <typename Context> class value {
FMT_INLINE value(const named_arg_info<char_type>* args, size_t size) FMT_INLINE value(const named_arg_info<char_type>* args, size_t size)
: named_args{args, size} {} : named_args{args, size} {}
template <typename T> FMT_CONSTEXPR FMT_INLINE value(T& val) { template <typename T> FMT_CONSTEXPR20 FMT_INLINE value(T& val) {
using value_type = remove_const_t<T>; using value_type = remove_const_t<T>;
custom.value = const_cast<value_type*>(&val); custom.value = const_cast<value_type*>(std::addressof(val));
// Get the formatter type through the context to allow different contexts // Get the formatter type through the context to allow different contexts
// have different extension points, e.g. `formatter<T>` for `format` and // have different extension points, e.g. `formatter<T>` for `format` and
// `printf_formatter<T>` for `printf`. // `printf_formatter<T>` for `printf`.
@ -1669,6 +1670,7 @@ template <typename Context> class basic_format_arg {
``vis(value)`` will be called with the value of type ``double``. ``vis(value)`` will be called with the value of type ``double``.
\endrst \endrst
*/ */
// DEPRECATED!
FMT_EXPORT FMT_EXPORT
template <typename Visitor, typename Context> template <typename Visitor, typename Context>
FMT_CONSTEXPR FMT_INLINE auto visit_format_arg( FMT_CONSTEXPR FMT_INLINE auto visit_format_arg(

View File

@ -920,7 +920,7 @@ class basic_memory_buffer final : public detail::buffer<T> {
private: private:
T store_[SIZE]; T store_[SIZE];
// Don't inherit from Allocator avoid generating type_info for it. // Don't inherit from Allocator to avoid generating type_info for it.
FMT_NO_UNIQUE_ADDRESS Allocator alloc_; FMT_NO_UNIQUE_ADDRESS Allocator alloc_;
// Deallocate memory allocated by the buffer. // Deallocate memory allocated by the buffer.
@ -3178,7 +3178,8 @@ FMT_CONSTEXPR20 inline void format_dragon(basic_fp<uint128_t> value,
} }
if (buf[0] == overflow) { if (buf[0] == overflow) {
buf[0] = '1'; buf[0] = '1';
++exp10; if ((flags & dragon::fixed) != 0) buf.push_back('0');
else ++exp10;
} }
return; return;
} }

View File

@ -8,6 +8,7 @@
#ifndef FMT_STD_H_ #ifndef FMT_STD_H_
#define FMT_STD_H_ #define FMT_STD_H_
#include <bitset>
#include <cstdlib> #include <cstdlib>
#include <exception> #include <exception>
#include <memory> #include <memory>
@ -15,6 +16,7 @@
#include <type_traits> #include <type_traits>
#include <typeinfo> #include <typeinfo>
#include <utility> #include <utility>
#include <vector>
#include "format.h" #include "format.h"
#include "ostream.h" #include "ostream.h"
@ -389,6 +391,50 @@ struct formatter<
#endif #endif
} }
}; };
namespace detail {
template <typename T, typename Enable = void>
struct has_flip : std::false_type {};
template <typename T>
struct has_flip<T, void_t<decltype(std::declval<T>().flip())>>
: std::true_type {};
template <typename T> struct is_bit_reference_like {
static constexpr const bool value =
std::is_convertible<T, bool>::value &&
std::is_nothrow_assignable<T, bool>::value && has_flip<T>::value;
};
#ifdef _LIBCPP_VERSION
// Workaround for libc++ incompatibility with C++ standard.
// According to the Standard, `bitset::operator[] const` returns bool.
template <typename C>
struct is_bit_reference_like<std::__bit_const_reference<C>> {
static constexpr const bool value = true;
};
#endif
} // namespace detail
// We can't use std::vector<bool, Allocator>::reference and
// std::bitset<N>::reference because the compiler can't deduce Allocator and N
// in partial specialization.
FMT_EXPORT
template <typename BitRef, typename Char>
struct formatter<BitRef, Char,
enable_if_t<detail::is_bit_reference_like<BitRef>::value>>
: formatter<bool, Char> {
template <typename FormatContext>
FMT_CONSTEXPR auto format(const BitRef& v, FormatContext& ctx) const
-> decltype(ctx.out()) {
return formatter<bool, Char>::format(v, ctx);
}
};
FMT_END_NAMESPACE FMT_END_NAMESPACE
#endif // FMT_STD_H_ #endif // FMT_STD_H_

View File

@ -1384,7 +1384,7 @@ double *Image::color2rgb(const char *color, int index)
{0/255.0, 0/255.0, 139/255.0}, {0/255.0, 0/255.0, 139/255.0},
{0/255.0, 139/255.0, 139/255.0}, {0/255.0, 139/255.0, 139/255.0},
{184/255.0, 134/255.0, 11/255.0}, {184/255.0, 134/255.0, 11/255.0},
{169/255.0, 169/255.0, 169/255.0}, {69/255.0, 69/255.0, 69/255.0},
{0/255.0, 100/255.0, 0/255.0}, {0/255.0, 100/255.0, 0/255.0},
{189/255.0, 183/255.0, 107/255.0}, {189/255.0, 183/255.0, 107/255.0},
{139/255.0, 0/255.0, 139/255.0}, {139/255.0, 0/255.0, 139/255.0},

View File

@ -41,8 +41,6 @@ set_tests_properties(TextFileReader PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${
add_executable(test_file_operations test_file_operations.cpp) add_executable(test_file_operations test_file_operations.cpp)
target_link_libraries(test_file_operations PRIVATE lammps GTest::GMock) target_link_libraries(test_file_operations PRIVATE lammps GTest::GMock)
add_test(NAME FileOperations COMMAND test_file_operations) add_test(NAME FileOperations COMMAND test_file_operations)
# try to mitigate possible OpenMPI bug
set_tests_properties(TextFileReader PROPERTIES ENVIRONMENT "OMPI_MCA_sharedfp=\"^sm\"")
add_executable(test_dump_atom test_dump_atom.cpp) add_executable(test_dump_atom test_dump_atom.cpp)
target_link_libraries(test_dump_atom PRIVATE lammps GTest::GMock) target_link_libraries(test_dump_atom PRIVATE lammps GTest::GMock)