diff --git a/decks/custom_init.cxx b/decks/custom_init.cxx index 20f7ea4..afcfd18 100644 --- a/decks/custom_init.cxx +++ b/decks/custom_init.cxx @@ -36,7 +36,7 @@ class Custom_Particle_Initializer : public Particle_Initializer { particle_list_t& particles, size_t nx, size_t ny, - size_t nz, + size_t, size_t ng, real_ dxp, size_t nppc, diff --git a/example/example.cpp b/example/example.cpp index 86270af..eaadf24 100755 --- a/example/example.cpp +++ b/example/example.cpp @@ -20,6 +20,20 @@ #include "input/deck.h" +// Requires C++14 +static auto make_field_solver(field_array_t &fields) +{ + // TODO: make this support 1/2/3d +#ifdef ES_FIELD_SOLVER + std::cout << "Created ES Solver" << std::endl; + Field_Solver field_solver(fields); +#else // EM + std::cout << "Created EM Solver" << std::endl; + Field_Solver field_solver(fields); +#endif + return field_solver; +} + // Global variable to hold paramters //Parameters params; Input_Deck deck; diff --git a/src/accumulator.cpp b/src/accumulator.cpp index 0e58128..dc3f9ba 100755 --- a/src/accumulator.cpp +++ b/src/accumulator.cpp @@ -5,9 +5,9 @@ void clear_accumulator_array( field_array_t& fields, accumulator_array_t& accumulators, - size_t nx, // TODO: we can probably pull these out of global params.. - size_t ny, - size_t nz + size_t, // TODO: we can probably pull these out of global params.. + size_t, + size_t ) { auto _clean_accumulator = KOKKOS_LAMBDA(const int i) @@ -39,7 +39,7 @@ void clear_accumulator_array( }; Kokkos::RangePolicy exec_policy( 0, fields.size() ); - Kokkos::parallel_for( exec_policy, _clean_accumulator, "clean_accumulator()" ); + Kokkos::parallel_for( "clean_accumulator()", exec_policy, _clean_accumulator ); } void unload_accumulator_array( @@ -107,7 +107,7 @@ void unload_accumulator_array( //may not be enough if particles run into ghost cells Kokkos::MDRangePolicy< Kokkos::Rank<3> > non_ghost_policy( {ng,ng,ng}, {nx+ng+1, ny+ng+1, nz+ng+1} ); // Try not to into ghosts // TODO: dry this - Kokkos::parallel_for( non_ghost_policy, _unload_accumulator, "unload_accumulator()" ); + Kokkos::parallel_for( "unload_accumulator()", non_ghost_policy, _unload_accumulator ); /* // Crib sheet for old variable names a0 = &a(x, y, z ); @@ -120,4 +120,3 @@ void unload_accumulator_array( */ } - diff --git a/src/fields.h b/src/fields.h index b2b963c..171f560 100755 --- a/src/fields.h +++ b/src/fields.h @@ -51,7 +51,7 @@ void serial_update_ghosts_B( //} Kokkos::MDRangePolicy> zy_policy({1,1}, {nz+1,ny+1}); - Kokkos::parallel_for( zy_policy, _zy_boundary, "zy boundary()" ); + Kokkos::parallel_for( "zy boundary()", zy_policy, _zy_boundary ); //for (int x = 0; x < nx+2; x++) { //for (int z = 1; z < nz+1; z++) { @@ -73,7 +73,7 @@ void serial_update_ghosts_B( }; //} Kokkos::MDRangePolicy> xz_policy({0,1}, {nx+2,nz+1}); - Kokkos::parallel_for( xz_policy, _xz_boundary, "xz boundary()" ); + Kokkos::parallel_for( "xz boundary()", xz_policy, _xz_boundary ); //for (int y = 0; y < ny+2; y++) { //for (int x = 0; x < nx+2; x++) { @@ -95,7 +95,7 @@ void serial_update_ghosts_B( }; //} Kokkos::MDRangePolicy> yx_policy({0,0}, {ny+2,nx+2}); - Kokkos::parallel_for( yx_policy, _yx_boundary, "yx boundary()" ); + Kokkos::parallel_for( "yx boundary()", yx_policy, _yx_boundary ); } } @@ -140,7 +140,7 @@ void serial_update_ghosts( } }; Kokkos::RangePolicy x_policy(1, nx+1); - Kokkos::parallel_for( x_policy, _x_boundary, "_x_boundary()" ); + Kokkos::parallel_for( "_x_boundary()", x_policy, _x_boundary ); //for ( y = 1; y <= ny; y++ ){ auto _y_boundary = KOKKOS_LAMBDA( const int y ) @@ -160,7 +160,7 @@ void serial_update_ghosts( } }; Kokkos::RangePolicy y_policy(1, ny+1); - Kokkos::parallel_for( y_policy, _y_boundary, "_y_boundary()" ); + Kokkos::parallel_for( "_y_boundary()", y_policy, _y_boundary ); //for ( z = 1; z <= nz; z++ ){ auto _z_boundary = KOKKOS_LAMBDA( const int z ) @@ -180,7 +180,7 @@ void serial_update_ghosts( } }; Kokkos::RangePolicy z_policy(1, nz+1); - Kokkos::parallel_for( z_policy, _z_boundary, "_z_boundary()" ); + Kokkos::parallel_for( "_z_boundary()", z_policy, _z_boundary ); // // Copy x from RHS -> LHS // int x = 1; @@ -311,7 +311,7 @@ template class Field_Solver : public Solver_Type jfz(i) = 0.0; }; - Kokkos::parallel_for( fields.size(), _init_fields, "init_fields()" ); + Kokkos::parallel_for( "init_fields()", fields.size(), _init_fields ); } void advance_b( @@ -349,14 +349,14 @@ class ES_Field_Solver public: void advance_b( - field_array_t& fields, - real_t px, - real_t py, - real_t pz, - size_t nx, - size_t ny, - size_t nz, - size_t ng + field_array_t&, + real_t, + real_t, + real_t, + size_t, + size_t, + size_t, + size_t ) { // No-op, becasue ES @@ -364,13 +364,13 @@ class ES_Field_Solver void advance_e( field_array_t& fields, - real_t px, - real_t py, - real_t pz, - size_t nx, - size_t ny, - size_t nz, - size_t ng, + real_t, + real_t, + real_t, + size_t, + size_t, + size_t, + size_t, real_t dt_eps0 ) { @@ -397,17 +397,17 @@ class ES_Field_Solver }; Kokkos::RangePolicy exec_policy( 0, fields.size() ); - Kokkos::parallel_for( exec_policy, _advance_e, "es_advance_e()" ); + Kokkos::parallel_for( "es_advance_e()", exec_policy, _advance_e ); } real_t e_energy( field_array_t& fields, - real_t px, - real_t py, - real_t pz, - size_t nx, - size_t ny, - size_t nz + real_t, + real_t, + real_t, + size_t, + size_t, + size_t ) { auto ex = Cabana::slice(fields); @@ -434,12 +434,12 @@ class ES_Field_Solver_1D real_t e_energy( field_array_t& fields, - real_t px, - real_t py, - real_t pz, - size_t nx, - size_t ny, - size_t nz + real_t, + real_t, + real_t, + size_t, + size_t, + size_t ) { auto ex = Cabana::slice(fields); @@ -460,9 +460,9 @@ class ES_Field_Solver_1D void advance_e( field_array_t& fields, - real_t px, - real_t py, - real_t pz, + real_t, + real_t, + real_t, size_t nx, size_t ny, size_t nz, @@ -490,7 +490,7 @@ class ES_Field_Solver_1D }; Kokkos::RangePolicy exec_policy( 0, fields.size() ); - Kokkos::parallel_for( exec_policy, _advance_e, "es_advance_e_1d()" ); + Kokkos::parallel_for( "es_advance_e_1d()", exec_policy, _advance_e ); } }; @@ -507,14 +507,14 @@ class EM_Field_Solver void dump_fields(FILE * fp, field_array_t& d_fields, real_t xmin, - real_t ymin, - real_t zmin, + real_t, + real_t, real_t dx, - real_t dy, - real_t dz, + real_t, + real_t, size_t nx, size_t ny, - size_t nz, + size_t, size_t ng ) { @@ -540,9 +540,9 @@ class EM_Field_Solver real_t e_energy( field_array_t& fields, - real_t px, - real_t py, - real_t pz, + real_t, + real_t, + real_t, size_t nx, size_t ny, size_t nz, @@ -572,9 +572,9 @@ class EM_Field_Solver real_t b_energy( field_array_t& fields, - real_t px, - real_t py, - real_t pz, + real_t, + real_t, + real_t, size_t nx, size_t ny, size_t nz, @@ -646,7 +646,7 @@ class EM_Field_Solver }; Kokkos::MDRangePolicy> zyx_policy({1, 1, 1}, {nx+2, ny+2, nz+2}); - Kokkos::parallel_for( zyx_policy, _advance_e, "advance_e()" ); + Kokkos::parallel_for( "advance_e()", zyx_policy, _advance_e ); } @@ -699,25 +699,11 @@ class EM_Field_Solver }; Kokkos::MDRangePolicy> zyx_policy({1, 1, 1}, {nx+1, ny+1, nz+1}); - Kokkos::parallel_for( zyx_policy, _advance_b, "advance_b()" ); + Kokkos::parallel_for( "advance_b()", zyx_policy, _advance_b ); serial_update_ghosts_B(cbx, cby, cbz, nx, ny, nz, ng); } }; -// Requires C++14 -static auto make_field_solver(field_array_t& fields) -{ - // TODO: make this support 1/2/3d -#ifdef ES_FIELD_SOLVER - std::cout << "Created ES Solver" << std::endl; - Field_Solver field_solver(fields); -#else // EM - std::cout << "Created EM Solver" << std::endl; - Field_Solver field_solver(fields); -#endif - return field_solver; -} - template void dump_energies( field_solver_t& field_solver, diff --git a/src/helpers.h b/src/helpers.h index 08c1fbc..66a3b75 100755 --- a/src/helpers.h +++ b/src/helpers.h @@ -28,7 +28,7 @@ int allow_for_ghosts(int pre_ghost) } // Function to print out the data for every particle. -void dump_particles( FILE * fp, const particle_list_t d_particles, const real_t xmin, const real_t ymin, const real_t zmin, const real_t dx, const real_t dy, const real_t dz,size_t nx,size_t ny,size_t nz, size_t ng) +void dump_particles( FILE * fp, const particle_list_t d_particles, const real_t xmin, const real_t, const real_t, const real_t dx, const real_t, const real_t, size_t nx,size_t ny,size_t, size_t ng) { // Host @@ -110,7 +110,7 @@ void print_fields( const field_array_t& fields ) }; Kokkos::RangePolicy exec_policy( 0, fields.size() ); - Kokkos::parallel_for( exec_policy, _print_fields, "print()" ); + Kokkos::parallel_for( "print()", exec_policy, _print_fields ); std::cout << std::endl; diff --git a/src/input/deck.h b/src/input/deck.h index 59ef128..09884bc 100644 --- a/src/input/deck.h +++ b/src/input/deck.h @@ -28,16 +28,16 @@ class Field_Initializer { virtual void init( field_array_t& fields, - size_t nx, - size_t ny, - size_t nz, - size_t ng, - real_ Lx, // TODO: do we prefer xmin or Lx? - real_ Ly, - real_ Lz, - real_ dx, - real_ dy, - real_ dz + size_t, + size_t, + size_t, + size_t, + real_, // TODO: do we prefer xmin or Lx? + real_, + real_, + real_, + real_, + real_ ) { std::cout << "Default field init" << std::endl; @@ -62,7 +62,7 @@ class Field_Initializer { cbz(i) = 0.0; }; - Kokkos::parallel_for( fields.size(), _init_fields, "zero_fields()" ); + Kokkos::parallel_for( "zero_fields()", fields.size(), _init_fields ); } }; @@ -80,15 +80,15 @@ class Particle_Initializer { particle_list_t& particles, size_t nx, size_t ny, - size_t nz, - size_t ng, + size_t, + size_t, real_ dxp, size_t nppc, real_ w, real_ v0, - real_ Lx, - real_ Ly, - real_ Lz + real_, + real_, + real_ ) { // TODO: this doesnt currently do anything with nppc/num_cells diff --git a/src/interpolator.cpp b/src/interpolator.cpp index 2aaae1b..ace233e 100755 --- a/src/interpolator.cpp +++ b/src/interpolator.cpp @@ -108,7 +108,7 @@ void load_interpolator_array( //Kokkos::RangePolicy exec_policy( 0, fields.size() ); // All cells Kokkos::MDRangePolicy< Kokkos::Rank<3> > non_ghost_policy( {ng,ng,ng}, {nx+ng, ny+ng, nz+ng} ); // Try not to into ghosts // TODO: dry this - Kokkos::parallel_for( non_ghost_policy, _load_interpolator, "load_interpolator()" ); + Kokkos::parallel_for( "load_interpolator()", non_ghost_policy, _load_interpolator ); /* pi = &fi(x, y, z ); @@ -167,6 +167,6 @@ void initialize_interpolator(interpolator_array_t& f0) dcbzdz(i) = 0.0; }; - Kokkos::parallel_for( f0.size(), _init_interpolator, "init_interpolator()" ); + Kokkos::parallel_for( "init_interpolator()", f0.size(), _init_interpolator ); } diff --git a/src/move_p.h b/src/move_p.h index b24c2c4..d6db0d3 100755 --- a/src/move_p.h +++ b/src/move_p.h @@ -6,7 +6,7 @@ // I make no claims that this is a sensible way to do this.. I just want it working ASAP // THIS DEALS WITH GHOSTS ITSELF -KOKKOS_INLINE_FUNCTION int detect_leaving_domain( size_t face, size_t nx, size_t ny, size_t nz, size_t ix, size_t iy, size_t iz, size_t num_ghosts) +KOKKOS_INLINE_FUNCTION int detect_leaving_domain( size_t, size_t nx, size_t ny, size_t nz, size_t ix, size_t iy, size_t iz, size_t ) { //RANK_TO_INDEX(ii, ix, iy, iz, (nx+(2*num_ghosts)), (ny+(2*num_ghosts))); @@ -65,7 +65,7 @@ template KOKKOS T5& a0, // TODO: does this need to be const real_t q, particle_mover_t& pm, - const grid_t* g, + const grid_t* , const size_t s, const size_t i, const size_t nx, diff --git a/tests/decks/CMakeLists.txt b/tests/decks/CMakeLists.txt index ee323eb..d5f5358 100644 --- a/tests/decks/CMakeLists.txt +++ b/tests/decks/CMakeLists.txt @@ -8,7 +8,7 @@ LIST(APPEND TESTS custom_init) # TODO: this should live somewhere more common to reduce code duplication foreach (test ${TESTS}) set(DECK_PATH "${PROJECT_SOURCE_DIR}/decks/${test}") - add_executable(${test} ${SOURCES} ${CabanaPIC_EXAMPLE_DIR}/example.cpp ${DECK_PATH}) + add_executable(${test} ${SOURCES} ${CabanaPIC_EXAMPLE_DIR}/example.cpp ${DECK_PATH}.cxx) target_compile_definitions(${test} PRIVATE USER_INPUT_DECK=${DECK_PATH}) target_link_libraries(${test} CabanaPIC) add_test(NAME ${test} COMMAND ./${test}) diff --git a/tests/energy_comparison/CMakeLists.txt b/tests/energy_comparison/CMakeLists.txt index eefe7de..ff871b1 100644 --- a/tests/energy_comparison/CMakeLists.txt +++ b/tests/energy_comparison/CMakeLists.txt @@ -11,7 +11,7 @@ list(APPEND gold_file "${CMAKE_CURRENT_SOURCE_DIR}/energies_gold") # TODO: avoid duplicating this link line everywhere foreach (test ${TESTS}) set(DECK_PATH "${test}") - add_executable(${test} ${SOURCES} ${CabanaPIC_EXAMPLE_DIR}/example.cpp ${DECK_PATH}) + add_executable(${test} ${SOURCES} ${CabanaPIC_EXAMPLE_DIR}/example.cpp ${DECK_PATH}.cxx) target_compile_definitions(${test} PRIVATE USER_INPUT_DECK=${DECK_PATH}) target_compile_definitions(${test} PRIVATE GOLD_ENERGY_FILE=${gold_file}.${test}.${REAL_TYPE}) target_link_libraries(${test} CabanaPIC)