Skip to content

Commit 2e72701

Browse files
committed
Cleanup to get rid of warnings
1 parent 001d575 commit 2e72701

File tree

6 files changed

+76
-32
lines changed

6 files changed

+76
-32
lines changed

bin/run.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ int main(int argc, char *argv[]) {
130130
temperature.resetLayerEventsUndercooling(grid);
131131

132132
// Initialize next layer of the simulation
133-
initExaCALayer(id, np, layernumber, cycle, inputs, grid, temperature, orientation, celldata,
134-
interface, nucleation, print, simulation_type);
133+
initExaCALayer(id, layernumber, cycle, inputs, grid, temperature, celldata, interface, nucleation);
135134
timers.stopLayer(layernumber);
136135
}
137136
else {
@@ -143,8 +142,7 @@ int main(int argc, char *argv[]) {
143142
MPI_Barrier(MPI_COMM_WORLD);
144143

145144
// Print ExaCA end-of-run data
146-
finalizeExaCA(id, np, cycle, inputs, timers, grid, temperature, irf, orientation, celldata, interface,
147-
nucleation, print, simulation_type);
145+
finalizeExaCA(id, np, cycle, inputs, timers, grid, temperature, orientation, celldata, interface, print);
148146
}
149147
}
150148
// Finalize Kokkos

bin/runCoupled.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// of layers where the return view stores time-temperature histories for layers l=0,1,2... where first_value[l] is the
1919
// index of the first event and last_value[l]-1 is the index of the last event associated with layer l
2020
Kokkos::View<double **, Kokkos::LayoutLeft, Kokkos::HostSpace>
21-
getFinchData(const int id, const int np, const int first_finch_simulation, const int num_finch_simulations,
21+
getFinchData(const int, const int, const int first_finch_simulation, const int num_finch_simulations,
2222
const int number_of_layers, Inputs exaca_inputs, std::array<double, 3> &exaca_low_corner,
2323
std::array<double, 3> &exaca_high_corner, std::vector<int> &first_value_finch,
2424
std::vector<int> &last_value_finch) {
@@ -154,7 +154,7 @@ int main(int argc, char *argv[]) {
154154
std::array<double, 3> exaca_low_corner, exaca_high_corner;
155155
// Should Finch simulations for all layers be performed and time-temperature history data stored prior to
156156
// running ExaCA, or should each Finch simulation be run one at a time between ExaCA-simulated layers?
157-
int num_finch_simulations, first_finch_simulation;
157+
int num_finch_simulations;
158158
if (inputs.temperature.layerwise_temp_read)
159159
num_finch_simulations = 1;
160160
else
@@ -253,8 +253,7 @@ int main(int argc, char *argv[]) {
253253
temperature.resetLayerEventsUndercooling(grid);
254254

255255
// Initialize next layer of the simulation
256-
initExaCALayer(id, np, layernumber, cycle, inputs, grid, temperature, orientation, celldata, interface,
257-
nucleation, print, "FromFinch");
256+
initExaCALayer(id, layernumber, cycle, inputs, grid, temperature, celldata, interface, nucleation);
258257
timers.stopLayer(layernumber);
259258
}
260259
else {
@@ -266,8 +265,7 @@ int main(int argc, char *argv[]) {
266265
MPI_Barrier(MPI_COMM_WORLD);
267266

268267
// Print ExaCA end-of-run data
269-
finalizeExaCA(id, np, cycle, inputs, timers, grid, temperature, irf, orientation, celldata, interface,
270-
nucleation, print, "FromFinch");
268+
finalizeExaCA(id, np, cycle, inputs, timers, grid, temperature, orientation, celldata, interface, print);
271269
}
272270

273271
// Finalize Kokkos & MPI

src/runCA.hpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ void runExaCALayer(int id, int np, int layernumber, int &cycle, Inputs inputs, T
2121
Interface<MemorySpace> &interface, Nucleation<MemorySpace> &nucleation, Print &print,
2222
std::string simulation_type) {
2323

24-
// Run on the default space.
25-
using memory_space = MemorySpace;
26-
2724
int x_switch = 0;
2825

2926
// Loop continues until all liquid cells claimed by solid grains, and no solid cells undergo remelting
@@ -96,10 +93,9 @@ void runExaCALayer(int id, int np, int layernumber, int &cycle, Inputs inputs, T
9693

9794
// Initialize structs for the next layer of a multilayer ExaCA simulation
9895
template <typename MemorySpace>
99-
void initExaCALayer(int id, int np, int layernumber, int &cycle, Inputs inputs, Grid &grid,
100-
Temperature<MemorySpace> temperature, Orientation<MemorySpace> &orientation,
101-
CellData<MemorySpace> &celldata, Interface<MemorySpace> &interface,
102-
Nucleation<MemorySpace> &nucleation, Print &print, std::string simulation_type) {
96+
void initExaCALayer(int id, int layernumber, int &cycle, Inputs inputs, Grid &grid,
97+
Temperature<MemorySpace> temperature, CellData<MemorySpace> &celldata,
98+
Interface<MemorySpace> &interface, Nucleation<MemorySpace> &nucleation) {
10399

104100
if (layernumber != grid.number_of_layers - 1) {
105101
// Resize and zero all view data relating to the active region from the last layer, in preparation for the
@@ -126,10 +122,8 @@ void initExaCALayer(int id, int np, int layernumber, int &cycle, Inputs inputs,
126122
// Finalize timer values, print end-of-run output to the console/files, and print the log file
127123
template <typename MemorySpace>
128124
void finalizeExaCA(int id, int np, int cycle, Inputs inputs, Timers timers, Grid &grid,
129-
Temperature<MemorySpace> temperature, InterfacialResponseFunction irf,
130-
Orientation<MemorySpace> &orientation, CellData<MemorySpace> &celldata,
131-
Interface<MemorySpace> &interface, Nucleation<MemorySpace> &nucleation, Print &print,
132-
std::string simulation_type) {
125+
Temperature<MemorySpace> temperature, Orientation<MemorySpace> &orientation,
126+
CellData<MemorySpace> &celldata, Interface<MemorySpace> &interface, Print &print) {
133127

134128
timers.startOutput();
135129

unit_test/test_harness_m.cmake

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# --------------------------------------------------------------------------##
2+
# Create main tests (all tests use Kokkos)
3+
# --------------------------------------------------------------------------##
4+
macro(ExaCA_add_tests)
5+
cmake_parse_arguments(EXACA_UNIT_TEST "MPI" "PACKAGE" "NAMES" ${ARGN})
6+
set(EXACA_UNIT_TEST_MPIEXEC_NUMPROCS 1)
7+
if(EXACA_UNIT_TEST_MPI)
8+
foreach(_np 2 4)
9+
if(MPIEXEC_MAX_NUMPROCS GREATER_EQUAL ${_np})
10+
list(APPEND EXACA_UNIT_TEST_MPIEXEC_NUMPROCS ${_np})
11+
endif()
12+
endforeach()
13+
endif()
14+
set(EXACA_UNIT_TEST_NUMTHREADS 1)
15+
foreach(_nt 2 4)
16+
if(MPIEXEC_MAX_NUMPROCS GREATER_EQUAL ${_nt})
17+
list(APPEND EXACA_UNIT_TEST_NUMTHREADS ${_nt})
18+
endif()
19+
endforeach()
20+
set(EXACA_UNIT_TEST_MAIN ${TEST_HARNESS_DIR}/unit_test_main.cpp)
21+
foreach(_device ${EXACA_TEST_DEVICES})
22+
set(_dir ${CMAKE_CURRENT_BINARY_DIR}/${_device})
23+
file(MAKE_DIRECTORY ${_dir})
24+
foreach(_test ${EXACA_UNIT_TEST_NAMES})
25+
set(_file ${_dir}/tst${_test}_${_device}.cpp)
26+
file(WRITE ${_file} "#include <Test${_device}_Category.hpp>\n"
27+
"#include <tst${_test}.hpp>\n")
28+
set(_target ExaCA_${_test}_test_${_device})
29+
add_executable(${_target} ${_file} ${EXACA_UNIT_TEST_MAIN})
30+
target_include_directories(${_target} PRIVATE ${_dir} ${TEST_HARNESS_DIR}
31+
${CMAKE_CURRENT_SOURCE_DIR})
32+
target_link_libraries(${_target} ${EXACA_UNIT_TEST_PACKAGE}
33+
${gtest_target})
34+
35+
foreach(_np ${EXACA_UNIT_TEST_MPIEXEC_NUMPROCS})
36+
# FIXME: remove PTHREAD
37+
if(_device STREQUAL PTHREAD
38+
OR _device STREQUAL THREADS
39+
OR _device STREQUAL OPENMP)
40+
foreach(_thread ${EXACA_UNIT_TEST_NUMTHREADS})
41+
add_test(
42+
NAME ${_target}_np_${_np}_nt_${_thread}
43+
COMMAND
44+
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${_np}
45+
${MPIEXEC_PREFLAGS} $<TARGET_FILE:${_target}>
46+
${MPIEXEC_POSTFLAGS} ${gtest_args} --kokkos-threads=${_thread})
47+
endforeach()
48+
else()
49+
add_test(
50+
NAME ${_target}_np_${_np}
51+
COMMAND
52+
${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${_np}
53+
${MPIEXEC_PREFLAGS} $<TARGET_FILE:${_target}>
54+
${MPIEXEC_POSTFLAGS} ${gtest_args})
55+
endif()
56+
endforeach()
57+
endforeach()
58+
endforeach()
59+
endmacro()

unit_test/tstTemperature.hpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ void testInit_UnidirectionalGradient(const std::string simulation_type, const do
304304
// Check temperature initialization for translated/mirrored FromFile or FromFinch data
305305
template <typename MemorySpace>
306306
void checkTemperatureResults(Inputs &inputs, Grid &grid, Temperature<MemorySpace> &temperature,
307-
const int number_of_copies, const int id, const int np, const bool mirror_x,
308-
const int number_of_layers, const int num_layers_with_points) {
307+
const int number_of_copies, const int, const int np, const bool mirror_x,
308+
const int num_layers_with_points) {
309309

310310
// Should have equal numbers of points associated with each layer - if initializing only 1 layer at a time, the data
311311
// from the other layers should not have been stored
@@ -347,7 +347,6 @@ void checkTemperatureResults(Inputs &inputs, Grid &grid, Temperature<MemorySpace
347347
// Make sure one data point was present in each expected cell per each layer of data stored. With number_of_copies =
348348
// 1, data will only be present at Y = 0 locally, and each copy is translated 1 cell in Y
349349
for (int index = 0; index < grid.domain_size; index++) {
350-
const int coord_x = grid.getCoordX(index);
351350
const int coord_y = grid.getCoordY(index);
352351
const int coord_z = grid.getCoordZ(index);
353352
if ((coord_y < number_of_copies) && (coord_z < np)) {
@@ -447,8 +446,7 @@ void testInitTemperatureFromFinch(const bool mirror_x, const int number_of_copie
447446
last_value);
448447

449448
// Check that the right ranks have the right temperature data
450-
checkTemperatureResults(inputs, grid, temperature, number_of_copies, id, np, mirror_x, number_of_layers,
451-
num_layers_with_points);
449+
checkTemperatureResults(inputs, grid, temperature, number_of_copies, id, np, mirror_x, num_layers_with_points);
452450
}
453451

454452
// Test storing temperature data from a file on the correct ExaCA ranks, using the same process at the FromFinch test
@@ -498,8 +496,7 @@ void testInitTemperatureFromFile(const bool mirror_x, const int number_of_copies
498496
temperature.readTemperatureData(id, grid, 0);
499497

500498
// Check that the right ranks have the right temperature data
501-
checkTemperatureResults(inputs, grid, temperature, number_of_copies, id, np, mirror_x, grid.number_of_layers,
502-
grid.number_of_layers);
499+
checkTemperatureResults(inputs, grid, temperature, number_of_copies, id, np, mirror_x, grid.number_of_layers);
503500
}
504501

505502
//---------------------------------------------------------------------------//

unit_test/tstUpdate.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ void testSmallDirS() {
9494
MPI_Barrier(MPI_COMM_WORLD);
9595

9696
// Print ExaCA end-of-run data
97-
finalizeExaCA(id, np, cycle, inputs, timers, grid, temperature, irf, orientation, celldata, interface, nucleation,
98-
print, "Directional");
97+
finalizeExaCA(id, np, cycle, inputs, timers, grid, temperature, orientation, celldata, interface, print);
9998
// MPI barrier to ensure that log file has been written
10099
MPI_Barrier(MPI_COMM_WORLD);
101100
std::string log_file = "TestProblemSmallDirS.json";
@@ -171,8 +170,7 @@ void testSmallEquiaxedGrain() {
171170
MPI_Barrier(MPI_COMM_WORLD);
172171

173172
// Print ExaCA end-of-run data
174-
finalizeExaCA(id, np, cycle, inputs, timers, grid, temperature, irf, orientation, celldata, interface, nucleation,
175-
print, "SingleGrain");
173+
finalizeExaCA(id, np, cycle, inputs, timers, grid, temperature, orientation, celldata, interface, print);
176174

177175
// MPI barrier to ensure that log file has been written
178176
MPI_Barrier(MPI_COMM_WORLD);

0 commit comments

Comments
 (0)