From 202f0392ab5a7a230b4f92e3a2a0947d773a9640 Mon Sep 17 00:00:00 2001 From: Will Saunders <77331509+will-saunders-ukaea@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:59:58 +0100 Subject: [PATCH] removed includes of CL/sycl.hpp (#235) * removed explicit includes of CL/sycl.hpp that did not check if SYCL/sycl.hpp exists (in general the import is transitive from NP * removed includes of SYCL/sycl.hpp and replaced with sycl/sycl.hpp as per the SYCL2020 standard * added config file for cmake-format * made formatting script more robust to config files not existing * added basic error code to formatting script * updated linear_interpolater to only include sycl from one source --- .cmake-format | 311 ++++++++++++++++++ CMakeLists.txt | 34 +- include/custom_types.hpp | 8 +- include/diagnostics.hpp | 4 +- include/fft_fftw.hpp | 4 +- include/fft_mkl.hpp | 2 +- include/interpolator.hpp | 3 +- include/linear_interpolator_1D.hpp | 2 - include/mesh.hpp | 7 +- .../function_basis_evaluation.hpp | 1 - .../function_basis_projection.hpp | 1 - include/plasma.hpp | 7 +- include/run_info.hpp | 7 +- include/simulation.hpp | 7 +- include/species.hpp | 10 +- include/sycl_typedefs.hpp | 11 + scripts/format_all.sh | 29 +- solvers/Electrostatic2D3V/CMakeLists.txt | 24 +- solvers/H3LAPD/CMakeLists.txt | 11 +- solvers/SimpleSOL/CMakeLists.txt | 20 +- src/diagnostics.cpp | 9 - src/linear_interpolator_1D.cpp | 2 - src/main.cpp | 6 +- src/mesh.cpp | 10 - src/plasma.cpp | 12 - src/species.cpp | 8 - test/unit/test_1D_linear_interpolator.cpp | 1 - 27 files changed, 396 insertions(+), 155 deletions(-) create mode 100644 .cmake-format create mode 100644 include/sycl_typedefs.hpp diff --git a/.cmake-format b/.cmake-format new file mode 100644 index 00000000..3e527096 --- /dev/null +++ b/.cmake-format @@ -0,0 +1,311 @@ +{ + "_help_parse": "Options affecting listfile parsing", + "parse": { + "_help_additional_commands": [ + "Specify structure for custom cmake functions" + ], + "additional_commands": { + "foo": { + "flags": [ + "BAR", + "BAZ" + ], + "kwargs": { + "HEADERS": "*", + "SOURCES": "*", + "DEPENDS": "*" + } + } + }, + "_help_override_spec": [ + "Override configurations per-command where available" + ], + "override_spec": {}, + "_help_vartags": [ + "Specify variable tags." + ], + "vartags": [], + "_help_proptags": [ + "Specify property tags." + ], + "proptags": [] + }, + "_help_format": "Options affecting formatting.", + "format": { + "_help_disable": [ + "Disable formatting entirely, making cmake-format a no-op" + ], + "disable": false, + "_help_line_width": [ + "How wide to allow formatted cmake files" + ], + "line_width": 80, + "_help_tab_size": [ + "How many spaces to tab for indent" + ], + "tab_size": 2, + "_help_use_tabchars": [ + "If true, lines are indented using tab characters (utf-8", + "0x09) instead of space characters (utf-8 0x20).", + "In cases where the layout would require a fractional tab", + "character, the behavior of the fractional indentation is", + "governed by " + ], + "use_tabchars": false, + "_help_fractional_tab_policy": [ + "If is True, then the value of this variable", + "indicates how fractional indentions are handled during", + "whitespace replacement. If set to 'use-space', fractional", + "indentation is left as spaces (utf-8 0x20). If set to", + "`round-up` fractional indentation is replaced with a single", + "tab character (utf-8 0x09) effectively shifting the column", + "to the next tabstop" + ], + "fractional_tab_policy": "use-space", + "_help_max_subgroups_hwrap": [ + "If an argument group contains more than this many sub-groups", + "(parg or kwarg groups) then force it to a vertical layout." + ], + "max_subgroups_hwrap": 2, + "_help_max_pargs_hwrap": [ + "If a positional argument group contains more than this many", + "arguments, then force it to a vertical layout." + ], + "max_pargs_hwrap": 6, + "_help_max_rows_cmdline": [ + "If a cmdline positional group consumes more than this many", + "lines without nesting, then invalidate the layout (and nest)" + ], + "max_rows_cmdline": 2, + "_help_separate_ctrl_name_with_space": [ + "If true, separate flow control names from their parentheses", + "with a space" + ], + "separate_ctrl_name_with_space": false, + "_help_separate_fn_name_with_space": [ + "If true, separate function names from parentheses with a", + "space" + ], + "separate_fn_name_with_space": false, + "_help_dangle_parens": [ + "If a statement is wrapped to more than one line, than dangle", + "the closing parenthesis on its own line." + ], + "dangle_parens": false, + "_help_dangle_align": [ + "If the trailing parenthesis must be 'dangled' on its on", + "line, then align it to this reference: `prefix`: the start", + "of the statement, `prefix-indent`: the start of the", + "statement, plus one indentation level, `child`: align to", + "the column of the arguments" + ], + "dangle_align": "prefix", + "_help_min_prefix_chars": [ + "If the statement spelling length (including space and", + "parenthesis) is smaller than this amount, then force reject", + "nested layouts." + ], + "min_prefix_chars": 4, + "_help_max_prefix_chars": [ + "If the statement spelling length (including space and", + "parenthesis) is larger than the tab width by more than this", + "amount, then force reject un-nested layouts." + ], + "max_prefix_chars": 10, + "_help_max_lines_hwrap": [ + "If a candidate layout is wrapped horizontally but it exceeds", + "this many lines, then reject the layout." + ], + "max_lines_hwrap": 2, + "_help_line_ending": [ + "What style line endings to use in the output." + ], + "line_ending": "unix", + "_help_command_case": [ + "Format command names consistently as 'lower' or 'upper' case" + ], + "command_case": "canonical", + "_help_keyword_case": [ + "Format keywords consistently as 'lower' or 'upper' case" + ], + "keyword_case": "unchanged", + "_help_always_wrap": [ + "A list of command names which should always be wrapped" + ], + "always_wrap": [], + "_help_enable_sort": [ + "If true, the argument lists which are known to be sortable", + "will be sorted lexicographicall" + ], + "enable_sort": true, + "_help_autosort": [ + "If true, the parsers may infer whether or not an argument", + "list is sortable (without annotation)." + ], + "autosort": false, + "_help_require_valid_layout": [ + "By default, if cmake-format cannot successfully fit", + "everything into the desired linewidth it will apply the", + "last, most aggressive attempt that it made. If this flag is", + "True, however, cmake-format will print error, exit with non-", + "zero status code, and write-out nothing" + ], + "require_valid_layout": false, + "_help_layout_passes": [ + "A dictionary mapping layout nodes to a list of wrap", + "decisions. See the documentation for more information." + ], + "layout_passes": {} + }, + "_help_markup": "Options affecting comment reflow and formatting.", + "markup": { + "_help_bullet_char": [ + "What character to use for bulleted lists" + ], + "bullet_char": "*", + "_help_enum_char": [ + "What character to use as punctuation after numerals in an", + "enumerated list" + ], + "enum_char": ".", + "_help_first_comment_is_literal": [ + "If comment markup is enabled, don't reflow the first comment", + "block in each listfile. Use this to preserve formatting of", + "your copyright/license statements." + ], + "first_comment_is_literal": false, + "_help_literal_comment_pattern": [ + "If comment markup is enabled, don't reflow any comment block", + "which matches this (regex) pattern. Default is `None`", + "(disabled)." + ], + "literal_comment_pattern": null, + "_help_fence_pattern": [ + "Regular expression to match preformat fences in comments", + "default= ``r'^\\s*([`~]{3}[`~]*)(.*)$'``" + ], + "fence_pattern": "^\\s*([`~]{3}[`~]*)(.*)$", + "_help_ruler_pattern": [ + "Regular expression to match rulers in comments default=", + "``r'^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$'``" + ], + "ruler_pattern": "^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$", + "_help_explicit_trailing_pattern": [ + "If a comment line matches starts with this pattern then it", + "is explicitly a trailing comment for the preceding argument.", + "Default is '#<'" + ], + "explicit_trailing_pattern": "#<", + "_help_hashruler_min_length": [ + "If a comment line starts with at least this many consecutive", + "hash characters, then don't lstrip() them off. This allows", + "for lazy hash rulers where the first hash char is not", + "separated by space" + ], + "hashruler_min_length": 10, + "_help_canonicalize_hashrulers": [ + "If true, then insert a space between the first hash char and", + "remaining hash chars in a hash ruler, and normalize its", + "length to fill the column" + ], + "canonicalize_hashrulers": true, + "_help_enable_markup": [ + "enable comment markup parsing and reflow" + ], + "enable_markup": true + }, + "_help_lint": "Options affecting the linter", + "lint": { + "_help_disabled_codes": [ + "a list of lint codes to disable" + ], + "disabled_codes": [], + "_help_function_pattern": [ + "regular expression pattern describing valid function names" + ], + "function_pattern": "[0-9a-z_]+", + "_help_macro_pattern": [ + "regular expression pattern describing valid macro names" + ], + "macro_pattern": "[0-9A-Z_]+", + "_help_global_var_pattern": [ + "regular expression pattern describing valid names for", + "variables with global (cache) scope" + ], + "global_var_pattern": "[A-Z][0-9A-Z_]+", + "_help_internal_var_pattern": [ + "regular expression pattern describing valid names for", + "variables with global scope (but internal semantic)" + ], + "internal_var_pattern": "_[A-Z][0-9A-Z_]+", + "_help_local_var_pattern": [ + "regular expression pattern describing valid names for", + "variables with local scope" + ], + "local_var_pattern": "[a-z][a-z0-9_]+", + "_help_private_var_pattern": [ + "regular expression pattern describing valid names for", + "privatedirectory variables" + ], + "private_var_pattern": "_[0-9a-z_]+", + "_help_public_var_pattern": [ + "regular expression pattern describing valid names for public", + "directory variables" + ], + "public_var_pattern": "[A-Z][0-9A-Z_]+", + "_help_argument_var_pattern": [ + "regular expression pattern describing valid names for", + "function/macro arguments and loop variables." + ], + "argument_var_pattern": "[a-z][a-z0-9_]+", + "_help_keyword_pattern": [ + "regular expression pattern describing valid names for", + "keywords used in functions or macros" + ], + "keyword_pattern": "[A-Z][0-9A-Z_]+", + "_help_max_conditionals_custom_parser": [ + "In the heuristic for C0201, how many conditionals to match", + "within a loop in before considering the loop a parser." + ], + "max_conditionals_custom_parser": 2, + "_help_min_statement_spacing": [ + "Require at least this many newlines between statements" + ], + "min_statement_spacing": 1, + "_help_max_statement_spacing": [ + "Require no more than this many newlines between statements" + ], + "max_statement_spacing": 2, + "max_returns": 6, + "max_branches": 12, + "max_arguments": 5, + "max_localvars": 15, + "max_statements": 50 + }, + "_help_encode": "Options affecting file encoding", + "encode": { + "_help_emit_byteorder_mark": [ + "If true, emit the unicode byte-order mark (BOM) at the start", + "of the file" + ], + "emit_byteorder_mark": false, + "_help_input_encoding": [ + "Specify the encoding of the input file. Defaults to utf-8" + ], + "input_encoding": "utf-8", + "_help_output_encoding": [ + "Specify the encoding of the output file. Defaults to utf-8.", + "Note that cmake only claims to support utf-8 so be careful", + "when using anything else" + ], + "output_encoding": "utf-8" + }, + "_help_misc": "Miscellaneous configurations options.", + "misc": { + "_help_per_command": [ + "A dictionary containing any per-command configuration", + "overrides. Currently only `command_case` is supported." + ], + "per_command": {} + } +} diff --git a/CMakeLists.txt b/CMakeLists.txt index 23392691..4d9af1b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,32 +16,33 @@ option(ENABLE_NESO_TESTS include(cmake/Sanitizers.cmake) include(cmake/CheckFileList.cmake) - - # ############################################################################## # Find dependencies # ############################################################################## -#USE -DNESO_SYCL_VENDOR to chose implementation at gen time -set(NESO_SYCL_VENDOR "Default" CACHE STRING "SYCL vendor to look for - required +# USE -DNESO_SYCL_VENDOR to chose implementation at gen time +set(NESO_SYCL_VENDOR + "Default" + CACHE STRING "SYCL vendor to look for - required if present") -set(NESO_SYCL_VERSION "" CACHE STRING "SYCL version to look for") +set(NESO_SYCL_VERSION + "" + CACHE STRING "SYCL version to look for") include(cmake/SYCL.cmake) -if (NESO_SYCL_VENDOR MATCHES "Default") - find_sycl() +if(NESO_SYCL_VENDOR MATCHES "Default") + find_sycl() else() - find_sycl(${NESO_SYCL_VENDOR} ${NESO_SYCL_VERSION}) + find_sycl(${NESO_SYCL_VENDOR} ${NESO_SYCL_VERSION}) endif() # # Use a custom FindNektar++ script to vide an interface target find_package(Nektar++ REQUIRED) -#Add the NESO-Particles dependencies +# Add the NESO-Particles dependencies find_package(NESO-Particles REQUIRED) -#Alternativly just use as submodule -#option(ENABLE_NESO_PARTICLES_TESTS OFF) -#add_subdirectory(neso-particles) -#include(neso-particles/cmake/restrict-keyword.cmake) +# Alternativly just use as submodule option(ENABLE_NESO_PARTICLES_TESTS OFF) +# add_subdirectory(neso-particles) +# include(neso-particles/cmake/restrict-keyword.cmake) find_package(FFT REQUIRED) if(FFT_FOUND) @@ -218,6 +219,7 @@ set(HEADER_FILES ${INC_DIR}/run_info.hpp ${INC_DIR}/simulation.hpp ${INC_DIR}/species.hpp + ${INC_DIR}/sycl_typedefs.hpp ${INC_DIR}/solvers/solver_callback_handler.hpp ${INC_DIR}/solvers/solver_runner.hpp ${INC_DIR}/velocity.hpp) @@ -239,10 +241,7 @@ target_compile_options(${NESO_LIBRARY_NAME} PRIVATE ${BUILD_TYPE_COMPILE_FLAGS}) target_link_options(${NESO_LIBRARY_NAME} PUBLIC ${BUILD_TYPE_LINK_FLAGS}) target_link_libraries( ${NESO_LIBRARY_NAME} - PUBLIC - Nektar++::nektar++ - fft::fft - NESO-Particles::NESO-Particles + PUBLIC Nektar++::nektar++ fft::fft NESO-Particles::NESO-Particles PRIVATE ${TEST_LIBRARIES}) add_sycl_to_target(TARGET ${NESO_LIBRARY_NAME} SOURCES ${LIB_SRC_FILES}) @@ -263,7 +262,6 @@ add_sycl_to_target(TARGET ${PROJECT_NAME} SOURCES ${MAIN_SRC}) # find MPI find_package(MPI REQUIRED) - # Solvers add_subdirectory(solvers) diff --git a/include/custom_types.hpp b/include/custom_types.hpp index e0f1b192..dc1f6adc 100644 --- a/include/custom_types.hpp +++ b/include/custom_types.hpp @@ -1,13 +1,9 @@ #ifndef NEPTUNE_CUSTOM_TYPES_H #define NEPTUNE_CUSTOM_TYPES_H -#if __has_include() -#include -#else -#include -#endif - +#include "sycl_typedefs.hpp" #include +#include // distribution function arrays using Complex = std::complex; diff --git a/include/diagnostics.hpp b/include/diagnostics.hpp index 04f07807..eb26215b 100644 --- a/include/diagnostics.hpp +++ b/include/diagnostics.hpp @@ -1,10 +1,10 @@ -class Diagnostics; - #ifndef __DIAGNOSTICS_H__ #define __DIAGNOSTICS_H__ +class Diagnostics; #include "mesh.hpp" #include "plasma.hpp" +#include "sycl_typedefs.hpp" class Diagnostics { public: diff --git a/include/fft_fftw.hpp b/include/fft_fftw.hpp index 5eb27ae8..ea9d7484 100644 --- a/include/fft_fftw.hpp +++ b/include/fft_fftw.hpp @@ -2,7 +2,7 @@ #define NEPTUNE_FFTFFTW_H #include "custom_types.hpp" -#include +#include "sycl_typedefs.hpp" #include #include @@ -15,7 +15,7 @@ class FFT { auto in_a = in_b.get_access(cgh); auto out_a = out_b.get_access(cgh); cgh.parallel_for( - sycl::range<1>{size_t(this->N)}, [=](cl::sycl::id<1> id) { + sycl::range<1>{size_t(this->N)}, [=](sycl::id<1> id) { reinterpret_cast(out_a[id])[0] = reinterpret_cast(in_a[id])[0]; reinterpret_cast(out_a[id])[1] = diff --git a/include/fft_mkl.hpp b/include/fft_mkl.hpp index 4b22ac80..c2900fdf 100644 --- a/include/fft_mkl.hpp +++ b/include/fft_mkl.hpp @@ -3,7 +3,7 @@ #include "custom_types.hpp" #include "oneapi/mkl/dfti.hpp" -#include +#include "sycl_typedefs.hpp" class FFT { public: diff --git a/include/interpolator.hpp b/include/interpolator.hpp index 82a31749..46e1dd6a 100644 --- a/include/interpolator.hpp +++ b/include/interpolator.hpp @@ -1,8 +1,7 @@ #ifndef __INTERPOLATOR_H__ #define __INTERPOLATOR_H__ -#include - #include +#include namespace NP = NESO::Particles; namespace NESO { diff --git a/include/linear_interpolator_1D.hpp b/include/linear_interpolator_1D.hpp index a7f0ca73..8af712b0 100644 --- a/include/linear_interpolator_1D.hpp +++ b/include/linear_interpolator_1D.hpp @@ -2,13 +2,11 @@ #define __LINEAR_INTERPOLATOR_1D_H__ #include "interpolator.hpp" -#include #include #include #include using namespace NESO::Particles; -using namespace cl; namespace NESO { /** diff --git a/include/mesh.hpp b/include/mesh.hpp index 7fde031c..44e4032b 100644 --- a/include/mesh.hpp +++ b/include/mesh.hpp @@ -7,14 +7,9 @@ class Mesh; #include "fft_wrappers.hpp" #include "plasma.hpp" #include "species.hpp" +#include "sycl_typedefs.hpp" #include -#if __has_include() -#include -#else -#include -#endif - class Mesh { public: Mesh(int nintervals = 10, double dt = 0.1, int nt = 1000); diff --git a/include/nektar_interface/function_basis_evaluation.hpp b/include/nektar_interface/function_basis_evaluation.hpp index a7d03caf..67d3c6d2 100644 --- a/include/nektar_interface/function_basis_evaluation.hpp +++ b/include/nektar_interface/function_basis_evaluation.hpp @@ -21,7 +21,6 @@ using namespace NESO::Particles; using namespace Nektar::LocalRegions; using namespace Nektar::StdRegions; -#include #include #include #include diff --git a/include/nektar_interface/function_basis_projection.hpp b/include/nektar_interface/function_basis_projection.hpp index 01f06324..2ae3eb1a 100644 --- a/include/nektar_interface/function_basis_projection.hpp +++ b/include/nektar_interface/function_basis_projection.hpp @@ -22,7 +22,6 @@ using namespace NESO::Particles; using namespace Nektar::LocalRegions; using namespace Nektar::StdRegions; -#include #include #include #include diff --git a/include/plasma.hpp b/include/plasma.hpp index 72cab313..3f0890ae 100644 --- a/include/plasma.hpp +++ b/include/plasma.hpp @@ -5,12 +5,7 @@ class Plasma; #include "mesh.hpp" #include "species.hpp" - -#if __has_include() -#include -#else -#include -#endif +#include "sycl_typedefs.hpp" class Plasma { public: diff --git a/include/run_info.hpp b/include/run_info.hpp index c79d5cb6..e772b293 100644 --- a/include/run_info.hpp +++ b/include/run_info.hpp @@ -1,11 +1,6 @@ #ifndef __RUNINFO_H__ #define __RUNINFO_H__ - -#if __has_include() -#include -#else -#include -#endif +#include "sycl_typedefs.hpp" class RunInfo { public: diff --git a/include/simulation.hpp b/include/simulation.hpp index 8cdd12a8..bb25bafe 100644 --- a/include/simulation.hpp +++ b/include/simulation.hpp @@ -3,12 +3,7 @@ #include "diagnostics.hpp" #include "mesh.hpp" #include "plasma.hpp" - -#if __has_include() -#include -#else -#include -#endif +#include "sycl_typedefs.hpp" void initialize(); void evolve(sycl::queue &q, Mesh &mesh, Plasma &plasma, FFT &fft, diff --git a/include/species.hpp b/include/species.hpp index ccad8308..25114b89 100644 --- a/include/species.hpp +++ b/include/species.hpp @@ -1,17 +1,11 @@ -class Species; - #ifndef __SPECIES_H__ #define __SPECIES_H__ +class Species; #include "mesh.hpp" +#include "sycl_typedefs.hpp" #include "velocity.hpp" -#if __has_include() -#include -#else -#include -#endif - class Species { public: Species(const Mesh &mesh, bool kinetic = true, double T = 1.0, double q = 1, diff --git a/include/sycl_typedefs.hpp b/include/sycl_typedefs.hpp new file mode 100644 index 00000000..ed975027 --- /dev/null +++ b/include/sycl_typedefs.hpp @@ -0,0 +1,11 @@ +#ifndef _NESO_SYCL_TYPEDEFS_H_ +#define _NESO_SYCL_TYPEDEFS_H_ + +#if __has_include() +#include +#else +#include +using namespace cl; +#endif + +#endif diff --git a/scripts/format_all.sh b/scripts/format_all.sh index 970fbc0e..ed1431b3 100644 --- a/scripts/format_all.sh +++ b/scripts/format_all.sh @@ -1,8 +1,23 @@ -# clang-format -find ./src ./include ./test ./solvers -iname \*.hpp -o -iname \*.cpp | xargs clang-format -i -# cmake-format -cmake-format -i CMakeLists.txt # Do this one on it's own so we don't go into build etc -find ./src ./include ./test ./solvers -iname CMakeLists.txt | xargs cmake-format -i -# black -find ./python -iname \*.py | xargs black +# This script formats the source files in NESO. This script should be ran from +# the root of the git repository. This script should be run as: +# +# bash format_all.sh +# +# to format all source files. + +if [[ -f .clang-format && -f .cmake-format ]]; then + # clang-format + find ./src ./include ./test ./solvers -iname \*.hpp -o -iname \*.cpp | xargs clang-format -i + # cmake-format + cmake-format -c .cmake-format -i CMakeLists.txt # Do this one on it's own so we don't go into build etc + find ./src ./include ./test ./solvers -iname CMakeLists.txt | xargs cmake-format -c .cmake-format -i + # black + find ./python -iname \*.py | xargs black + exit 0; +else + echo "ERROR: The files .clang-format and .cmake-format do not exist. Please + check this script is executed from the root directory of the git + repository." + exit 1; +fi diff --git a/solvers/Electrostatic2D3V/CMakeLists.txt b/solvers/Electrostatic2D3V/CMakeLists.txt index f4ddfa88..b2f198a1 100644 --- a/solvers/Electrostatic2D3V/CMakeLists.txt +++ b/solvers/Electrostatic2D3V/CMakeLists.txt @@ -9,17 +9,13 @@ set(ELECTROSTATIC_2D3V_LIBRARY_NAME add_library(${ELECTROSTATIC_2D3V_LIBRARY_NAME} OBJECT ${CMAKE_CURRENT_LIST_DIR}/EquationSystems/PoissonPIC.cpp) -target_include_directories( - ${ELECTROSTATIC_2D3V_LIBRARY_NAME} - PRIVATE ${CMAKE_SOURCE_DIR}/include) - +target_include_directories(${ELECTROSTATIC_2D3V_LIBRARY_NAME} + PRIVATE ${CMAKE_SOURCE_DIR}/include) target_link_libraries( ${ELECTROSTATIC_2D3V_LIBRARY_NAME} - PRIVATE ${NESO_LIBRARY_NAME} - Nektar++::nektar++ - NESO-Particles::NESO-Particles - MPI::MPI_CXX) + PRIVATE ${NESO_LIBRARY_NAME} Nektar++::nektar++ + NESO-Particles::NESO-Particles MPI::MPI_CXX) # create the solver binary file(GLOB Electrostatic2D3VSource @@ -29,15 +25,11 @@ add_executable(${EXEC_TARGET_NAME} ${Electrostatic2D3VSource}) target_link_libraries( ${EXEC_TARGET_NAME} - PRIVATE ${ELECTROSTATIC_2D3V_LIBRARY_NAME} - Nektar++::nektar++ - MPI::MPI_CXX - NESO-Particles::NESO-Particles) - - -target_include_directories( - ${EXEC_TARGET_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/include) + PRIVATE ${ELECTROSTATIC_2D3V_LIBRARY_NAME} Nektar++::nektar++ MPI::MPI_CXX + NESO-Particles::NESO-Particles) +target_include_directories(${EXEC_TARGET_NAME} + PRIVATE ${CMAKE_SOURCE_DIR}/include) add_sycl_to_target(TARGET ${EXEC_TARGET_NAME} SOURCES ${Electrostatic2D3VSource}) diff --git a/solvers/H3LAPD/CMakeLists.txt b/solvers/H3LAPD/CMakeLists.txt index 2ee77101..c8e2b079 100644 --- a/solvers/H3LAPD/CMakeLists.txt +++ b/solvers/H3LAPD/CMakeLists.txt @@ -12,12 +12,11 @@ set(SOLVER_LIBS add_library(${LIBRARY_NAME} OBJECT ${H3LAPD_SRC_FILES}) target_compile_options(${LIBRARY_NAME} PRIVATE ${BUILD_TYPE_COMPILE_FLAGS}) target_link_libraries(${LIBRARY_NAME} PRIVATE Nektar++::nektar++ - NESO-Particles::NESO-Particles) + NESO-Particles::NESO-Particles) # Top-level include dir for nektar-interface headers set(TOPLEVEL_INCLUDE_DIR "${INC_DIR}") -target_include_directories( - ${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR} - ${TOPLEVEL_INCLUDE_DIR}) +target_include_directories(${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR} + ${TOPLEVEL_INCLUDE_DIR}) add_sycl_to_target(TARGET ${LIBRARY_NAME} SOURCES ${H3LAPD_SRC_FILES}) @@ -32,8 +31,8 @@ target_compile_options(${EXEC_TARGET_NAME} PRIVATE ${BUILD_TYPE_COMPILE_FLAGS}) # Linker options, target libs target_link_options(${EXEC_TARGET_NAME} PRIVATE ${BUILD_TYPE_LINK_FLAGS}) target_link_libraries( - ${EXEC_TARGET_NAME} PRIVATE Nektar++::nektar++ - NESO-Particles::NESO-Particles ${NESO_LIBRARY_NAME}) + ${EXEC_TARGET_NAME} PRIVATE Nektar++::nektar++ NESO-Particles::NESO-Particles + ${NESO_LIBRARY_NAME}) add_sycl_to_target(TARGET ${EXEC_TARGET_NAME} SOURCES main.cpp) diff --git a/solvers/SimpleSOL/CMakeLists.txt b/solvers/SimpleSOL/CMakeLists.txt index 31c4040e..30d2b5eb 100644 --- a/solvers/SimpleSOL/CMakeLists.txt +++ b/solvers/SimpleSOL/CMakeLists.txt @@ -1,10 +1,7 @@ # Identify source files set(SIMPLE_SOL_SRC_FILES - EquationSystems/SOLSystem.cpp - EquationSystems/SOLWithParticlesSystem.cpp - Forcing/SourceTerms.cpp - SimpleSOL.cpp - ) + EquationSystems/SOLSystem.cpp EquationSystems/SOLWithParticlesSystem.cpp + Forcing/SourceTerms.cpp SimpleSOL.cpp) # ============================== Object library =============================== # Put solver specific source in an object library so that tests can use it @@ -14,14 +11,13 @@ set(SOLVER_LIBS CACHE INTERNAL "") add_library(${LIBRARY_NAME} OBJECT ${SIMPLE_SOL_SRC_FILES}) target_compile_options(${LIBRARY_NAME} PRIVATE ${BUILD_TYPE_COMPILE_FLAGS}) -target_link_libraries(${LIBRARY_NAME} PRIVATE Nektar++::nektar++ - NESO-Particles::NESO-Particles - ${NESO_LIBRARY_NAME}) +target_link_libraries( + ${LIBRARY_NAME} PRIVATE Nektar++::nektar++ NESO-Particles::NESO-Particles + ${NESO_LIBRARY_NAME}) # Top-level include dir for nektar-interface headers set(TOPLEVEL_INCLUDE_DIR "${INC_DIR}") -target_include_directories( - ${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR} - ${TOPLEVEL_INCLUDE_DIR}) +target_include_directories(${LIBRARY_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR} + ${TOPLEVEL_INCLUDE_DIR}) add_sycl_to_target(TARGET ${LIBRARY_NAME} SOURCES ${SIMPLE_SOL_SRC_FILES}) @@ -36,7 +32,7 @@ target_compile_options(${EXEC_TARGET_NAME} PRIVATE ${BUILD_TYPE_COMPILE_FLAGS}) # Linker options, target libs target_link_options(${EXEC_TARGET_NAME} PRIVATE ${BUILD_TYPE_LINK_FLAGS}) target_link_libraries( - ${EXEC_TARGET_NAME} PRIVATE Nektar++::nektar++ NESO-Particles::NESO-Particles + ${EXEC_TARGET_NAME} PRIVATE Nektar++::nektar++ NESO-Particles::NESO-Particles ${NESO_LIBRARY_NAME}) add_sycl_to_target(TARGET ${EXEC_TARGET_NAME} SOURCES main.cpp) diff --git a/src/diagnostics.cpp b/src/diagnostics.cpp index 54765c84..ac1c1269 100644 --- a/src/diagnostics.cpp +++ b/src/diagnostics.cpp @@ -1,18 +1,9 @@ /* * Module for dealing with diagnostics */ - #include "diagnostics.hpp" -#include "mesh.hpp" -#include "plasma.hpp" #include -#if __has_include() -#include -#else -#include -#endif - /* * Store simulation time as a vector */ diff --git a/src/linear_interpolator_1D.cpp b/src/linear_interpolator_1D.cpp index 60b9ac6f..8c714064 100644 --- a/src/linear_interpolator_1D.cpp +++ b/src/linear_interpolator_1D.cpp @@ -1,11 +1,9 @@ #include "linear_interpolator_1D.hpp" -#include #include #include #include using namespace NESO::Particles; -using namespace cl; namespace NESO { /** diff --git a/src/main.cpp b/src/main.cpp index d2ea4820..bd91a469 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,11 +5,7 @@ #include "revision.hpp" #include "run_info.hpp" #include "simulation.hpp" -#if __has_include() -#include -#else -#include -#endif +#include "sycl_typedefs.hpp" #include #include diff --git a/src/mesh.cpp b/src/mesh.cpp index a322b0c5..c2f7460d 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -3,19 +3,9 @@ */ #include "mesh.hpp" -#include "custom_types.hpp" -#include "fft_wrappers.hpp" -#include "species.hpp" #include #include #include -#include - -#if __has_include() -#include -#else -#include -#endif /* * Initialize mesh diff --git a/src/plasma.cpp b/src/plasma.cpp index 8bc76bf6..35646ca3 100644 --- a/src/plasma.cpp +++ b/src/plasma.cpp @@ -1,20 +1,8 @@ /* * Module for dealing with particles */ - #include "plasma.hpp" -#include "mesh.hpp" #include "species.hpp" -#include -#include -#include -#include - -#if __has_include() -#include -#else -#include -#endif /* * Initialize particles diff --git a/src/species.cpp b/src/species.cpp index 04d2bf80..92d84162 100644 --- a/src/species.cpp +++ b/src/species.cpp @@ -3,18 +3,10 @@ */ #include "species.hpp" -#include "mesh.hpp" #include -#include #include #include -#if __has_include() -#include -#else -#include -#endif - /* * Initialize particles */ diff --git a/test/unit/test_1D_linear_interpolator.cpp b/test/unit/test_1D_linear_interpolator.cpp index 901d5c46..488c1a1a 100644 --- a/test/unit/test_1D_linear_interpolator.cpp +++ b/test/unit/test_1D_linear_interpolator.cpp @@ -1,5 +1,4 @@ #include "linear_interpolator_1D.hpp" -#include #include #include #include