Skip to content

Commit

Permalink
Merge pull request #372 from bluescarni/pr/cleanups
Browse files Browse the repository at this point in the history
Small cleanups and move kwargs into kw.hpp
  • Loading branch information
bluescarni authored Dec 11, 2023
2 parents 1a52c5c + 0b10735 commit 6d4871e
Show file tree
Hide file tree
Showing 154 changed files with 214 additions and 115 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gha_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Build
shell: pwsh
run: |
conda install -y cmake 'llvmdev=13.*' tbb-devel tbb boost-cpp xtensor xtensor-blas blas blas-devel fmt spdlog sleef zlib libzlib 'mppp>=0.27'
conda install -y cmake 'llvmdev=13.*' tbb-devel tbb boost-cpp xtensor xtensor-blas blas blas-devel fmt spdlog sleef zlib libzlib 'mppp=1.*'
mkdir build
cd build
cmake ../ -G "Visual Studio 17 2022" -A x64 -DHEYOKA_BUILD_TESTS=yes -DHEYOKA_WITH_MPPP=yes -DHEYOKA_BUILD_TUTORIALS=ON -DHEYOKA_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON -DHEYOKA_WITH_SLEEF=yes -DMPPP_GMP_INCLUDE_DIR=C:\Miniconda\envs\test\Library\include -DMPPP_GMP_LIBRARY=C:\Miniconda\envs\test\Library\lib\mpir.lib
Expand All @@ -56,7 +56,7 @@ jobs:
- name: Build
shell: pwsh
run: |
conda install -y cmake 'llvmdev=14.*' tbb-devel tbb boost-cpp xtensor xtensor-blas blas blas-devel fmt spdlog sleef zlib libzlib 'mppp>=0.27'
conda install -y cmake 'llvmdev=14.*' tbb-devel tbb boost-cpp xtensor xtensor-blas blas blas-devel fmt spdlog sleef zlib libzlib 'mppp=1.*'
mkdir build
cd build
cmake ../ -G "Visual Studio 17 2022" -A x64 -DHEYOKA_BUILD_TESTS=yes -DHEYOKA_WITH_MPPP=yes -DHEYOKA_BUILD_TUTORIALS=ON -DHEYOKA_ENABLE_IPO=yes -DBoost_NO_BOOST_CMAKE=ON -DHEYOKA_WITH_SLEEF=yes -DMPPP_GMP_INCLUDE_DIR=C:\Miniconda\envs\test\Library\include -DMPPP_GMP_LIBRARY=C:\Miniconda\envs\test\Library\lib\mpir.lib
Expand Down
1 change: 1 addition & 0 deletions benchmark/burrau_3bp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <xtensor/xadapt.hpp>
#include <xtensor/xview.hpp>

#include <heyoka/kw.hpp>
#include <heyoka/model/nbody.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/event_allocations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <boost/program_options.hpp>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/math/sin.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/event_overhead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <iostream>
#include <vector>

#include <heyoka/kw.hpp>
#include <heyoka/model/nbody.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/hh_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <boost/program_options.hpp>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/taylor.hpp>

#include "benchmark_utils.hpp"
Expand Down
1 change: 1 addition & 0 deletions benchmark/large_cfunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <vector>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/llvm_state.hpp>
#include <heyoka/logging.hpp>
#include <heyoka/model/mascon.hpp>
Expand Down
1 change: 0 additions & 1 deletion benchmark/mascon_models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <iostream>
#include <vector>

#include <heyoka/detail/igor.hpp>
#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/llvm_state.hpp>
Expand Down
1 change: 1 addition & 0 deletions benchmark/mb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <spdlog/stopwatch.h>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/logging.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/outer_ss_long_term.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#endif

#include <heyoka/kw.hpp>
#include <heyoka/model/nbody.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/outer_ss_long_term_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#endif

#include <heyoka/kw.hpp>
#include <heyoka/model/nbody.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/pcr3bp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <tuple>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/math/pow.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/pendulum_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <iostream>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/math/sin.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/pendulum_mp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <mp++/real.hpp>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/logging.hpp>
#include <heyoka/math/sin.hpp>
#include <heyoka/taylor.hpp>
Expand Down
1 change: 1 addition & 0 deletions benchmark/pendulum_quad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <mp++/real128.hpp>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/logging.hpp>
#include <heyoka/math/sin.hpp>
#include <heyoka/taylor.hpp>
Expand Down
1 change: 1 addition & 0 deletions benchmark/sims_flanagan_jac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <spdlog/spdlog.h>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/llvm_state.hpp>
#include <heyoka/logging.hpp>
#include <heyoka/math/cos.hpp>
Expand Down
1 change: 1 addition & 0 deletions benchmark/ss_3bp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <boost/program_options.hpp>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/model/nbody.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/ss_event_overhead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#endif

#include <heyoka/kw.hpp>
#include <heyoka/model/nbody.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/ss_maker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

#endif

#include <heyoka/kw.hpp>
#include <heyoka/logging.hpp>
#include <heyoka/model/nbody.hpp>
#include <heyoka/taylor.hpp>
Expand Down
1 change: 1 addition & 0 deletions benchmark/taylor_jl_01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <iostream>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/taylor.hpp>

#include "benchmark_utils.hpp"
Expand Down
1 change: 1 addition & 0 deletions benchmark/two_body_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#endif

#include <heyoka/kw.hpp>
#include <heyoka/model/nbody.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/two_body_step_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#endif

#include <heyoka/kw.hpp>
#include <heyoka/model/nbody.hpp>
#include <heyoka/taylor.hpp>

Expand Down
6 changes: 6 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Changelog
Changes
~~~~~~~

- Move the declarations of all :ref:`keyword arguments <kwargs>`
into the ``kw.hpp`` header
(`#372 <https://github.com/bluescarni/heyoka/pull/372>`__).
- The call operators of the event callbacks are not
``const`` any more
(`#369 <https://github.com/bluescarni/heyoka/pull/369>`__).
- **BREAKING**: the minimum supported LLVM version is now 13
(`#369 <https://github.com/bluescarni/heyoka/pull/369>`__).
This is a :ref:`breaking change <bchanges_4_0_0>`.
Expand Down
17 changes: 0 additions & 17 deletions include/heyoka/expression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

#include <heyoka/detail/func_cache.hpp>
#include <heyoka/detail/fwd_decl.hpp>
#include <heyoka/detail/igor.hpp>
#include <heyoka/detail/llvm_fwd.hpp>
#include <heyoka/detail/type_traits.hpp>
#include <heyoka/detail/visibility.hpp>
Expand Down Expand Up @@ -424,14 +423,6 @@ HEYOKA_DLL_PUBLIC expression diff(const expression &, const param &);
HEYOKA_DLL_PUBLIC expression diff(const expression &, const std::string &);
HEYOKA_DLL_PUBLIC expression diff(const expression &, const expression &);

namespace kw
{

IGOR_MAKE_NAMED_ARGUMENT(diff_args);
IGOR_MAKE_NAMED_ARGUMENT(diff_order);

} // namespace kw

namespace detail
{

Expand Down Expand Up @@ -713,14 +704,6 @@ function_decompose(const std::vector<expression> &);
HEYOKA_DLL_PUBLIC std::vector<expression> function_decompose(const std::vector<expression> &,
const std::vector<expression> &);

namespace kw
{

IGOR_MAKE_NAMED_ARGUMENT(vars);
IGOR_MAKE_NAMED_ARGUMENT(batch_size);

} // namespace kw

namespace detail
{

Expand Down
66 changes: 57 additions & 9 deletions include/heyoka/kw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,80 @@
#include <heyoka/config.hpp>
#include <heyoka/detail/igor.hpp>

// NOTE: these are keyword arguments that are
// shared among several files.
// NOTE: all keyword arguments are gathered
// in this file in order to make it easier to
// prevent name collisions.

HEYOKA_BEGIN_NAMESPACE

namespace kw
{

IGOR_MAKE_NAMED_ARGUMENT(masses);
IGOR_MAKE_NAMED_ARGUMENT(omega);
IGOR_MAKE_NAMED_ARGUMENT(Gconst);
// llvm_state.
IGOR_MAKE_NAMED_ARGUMENT(mname);
IGOR_MAKE_NAMED_ARGUMENT(opt_level);
IGOR_MAKE_NAMED_ARGUMENT(fast_math);
// NOTE: this flag is used to force the use of 512-bit AVX512
// registers (if the CPU supports them). At the time of this writing,
// LLVM defaults to 256-bit registers due to CPU downclocking issues
// which can lead to performance degradation. Hopefully we
// can get rid of this in the future when AVX512 implementations improve
// and LLVM learns to discriminate good and bad implementations.
IGOR_MAKE_NAMED_ARGUMENT(force_avx512);
IGOR_MAKE_NAMED_ARGUMENT(slp_vectorize);

// cfunc API.
IGOR_MAKE_NAMED_ARGUMENT(vars);
IGOR_MAKE_NAMED_ARGUMENT(batch_size);

// taylor_adaptive and friends.
IGOR_MAKE_NAMED_ARGUMENT(tol);
IGOR_MAKE_NAMED_ARGUMENT(pars);
IGOR_MAKE_NAMED_ARGUMENT(t_events);
IGOR_MAKE_NAMED_ARGUMENT(nt_events);
// NOTE: these are used for constructing events.
IGOR_MAKE_NAMED_ARGUMENT(callback);
IGOR_MAKE_NAMED_ARGUMENT(cooldown);
IGOR_MAKE_NAMED_ARGUMENT(direction);
// NOTE: these are used in the
// propagate_*() functions.
IGOR_MAKE_NAMED_ARGUMENT(max_steps);
IGOR_MAKE_NAMED_ARGUMENT(max_delta_t);
IGOR_MAKE_NAMED_ARGUMENT(write_tc);
IGOR_MAKE_NAMED_ARGUMENT(c_output);

// Diff tensors API.
IGOR_MAKE_NAMED_ARGUMENT(diff_args);
IGOR_MAKE_NAMED_ARGUMENT(diff_order);

// Used in several APIs.
IGOR_MAKE_NAMED_ARGUMENT(time);
IGOR_MAKE_NAMED_ARGUMENT(prec);
IGOR_MAKE_NAMED_ARGUMENT(compact_mode);
IGOR_MAKE_NAMED_ARGUMENT(high_accuracy);
IGOR_MAKE_NAMED_ARGUMENT(parallel_mode);
IGOR_MAKE_NAMED_ARGUMENT(prec);
IGOR_MAKE_NAMED_ARGUMENT(mu);
IGOR_MAKE_NAMED_ARGUMENT(thresh);

// kwargs for the ffnn
// ffnn model.
IGOR_MAKE_NAMED_ARGUMENT(inputs);
IGOR_MAKE_NAMED_ARGUMENT(nn_hidden);
IGOR_MAKE_NAMED_ARGUMENT(n_out);
IGOR_MAKE_NAMED_ARGUMENT(activations);
IGOR_MAKE_NAMED_ARGUMENT(nn_wb);

// Fixed centres model.
IGOR_MAKE_NAMED_ARGUMENT(positions);

// Pendulum model.
IGOR_MAKE_NAMED_ARGUMENT(gconst);
IGOR_MAKE_NAMED_ARGUMENT(length);

// Used in multiple models.
IGOR_MAKE_NAMED_ARGUMENT(masses);
IGOR_MAKE_NAMED_ARGUMENT(omega);
IGOR_MAKE_NAMED_ARGUMENT(Gconst);
IGOR_MAKE_NAMED_ARGUMENT(mu);
IGOR_MAKE_NAMED_ARGUMENT(thresh);

} // namespace kw

HEYOKA_END_NAMESPACE
Expand Down
20 changes: 1 addition & 19 deletions include/heyoka/llvm_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#if defined(HEYOKA_HAVE_REAL128)

Expand All @@ -34,10 +33,10 @@
#endif

#include <heyoka/detail/fwd_decl.hpp>
#include <heyoka/detail/igor.hpp>
#include <heyoka/detail/llvm_fwd.hpp>
#include <heyoka/detail/type_traits.hpp>
#include <heyoka/detail/visibility.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/s11n.hpp>

HEYOKA_BEGIN_NAMESPACE
Expand Down Expand Up @@ -73,23 +72,6 @@ HEYOKA_DLL_PUBLIC const target_features &get_target_features();

} // namespace detail

namespace kw
{

IGOR_MAKE_NAMED_ARGUMENT(mname);
IGOR_MAKE_NAMED_ARGUMENT(opt_level);
IGOR_MAKE_NAMED_ARGUMENT(fast_math);
// NOTE: this flag is used to force the use of 512-bit AVX512
// registers (if the CPU supports them). At the time of this writing,
// LLVM defaults to 256-bit registers due to CPU downclocking issues
// which can lead to performance degradation. Hopefully we
// can get rid of this in the future when AVX512 implementations improve
// and LLVM learns to discriminate good and bad implementations.
IGOR_MAKE_NAMED_ARGUMENT(force_avx512);
IGOR_MAKE_NAMED_ARGUMENT(slp_vectorize);

} // namespace kw

HEYOKA_DLL_PUBLIC std::ostream &operator<<(std::ostream &, const llvm_state &);

template <typename T>
Expand Down
1 change: 0 additions & 1 deletion include/heyoka/model/cr3bp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <vector>

#include <heyoka/config.hpp>
#include <heyoka/detail/igor.hpp>
#include <heyoka/detail/visibility.hpp>
#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
Expand Down
1 change: 0 additions & 1 deletion include/heyoka/model/elp2000.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <vector>

#include <heyoka/config.hpp>
#include <heyoka/detail/igor.hpp>
#include <heyoka/detail/visibility.hpp>
#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
Expand Down
1 change: 0 additions & 1 deletion include/heyoka/model/ffnn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <boost/safe_numerics/safe_integer.hpp>

#include <heyoka/config.hpp>
#include <heyoka/detail/igor.hpp>
#include <heyoka/detail/type_traits.hpp>
#include <heyoka/detail/visibility.hpp>
#include <heyoka/expression.hpp>
Expand Down
Loading

0 comments on commit 6d4871e

Please sign in to comment.