Skip to content

Commit

Permalink
fix cmake to compile synthesis benchmark; fix compile issues in bench…
Browse files Browse the repository at this point in the history
…mark; remove the restart mains and allow the regular mains to get a restart parameter
  • Loading branch information
nmm0 committed Feb 3, 2021
1 parent 53d997d commit 3133b96
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 372 deletions.
14 changes: 5 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,30 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")

add_executable(heatdis_resil)
add_executable(heatdis_veloc)
add_executable(heatdis_restart_resil)
add_executable(heatdis_restart_veloc)
add_executable(heatdis_synthesis_benchmark)

add_subdirectory(src)

find_package(MPI REQUIRED)
target_link_libraries(heatdis_resil PRIVATE MPI::MPI_CXX)
target_link_libraries(heatdis_veloc PRIVATE MPI::MPI_CXX)
target_link_libraries(heatdis_restart_resil PRIVATE MPI::MPI_CXX)
target_link_libraries(heatdis_restart_veloc PRIVATE MPI::MPI_CXX)
target_link_libraries(heatdis_synthesis_benchmark PRIVATE MPI::MPI_CXX)

find_package(Kokkos REQUIRED)
target_link_libraries(heatdis_resil PRIVATE Kokkos::kokkos)
target_link_libraries(heatdis_veloc PRIVATE Kokkos::kokkos)
target_link_libraries(heatdis_restart_resil PRIVATE Kokkos::kokkos)
target_link_libraries(heatdis_restart_veloc PRIVATE Kokkos::kokkos)
target_link_libraries(heatdis_synthesis_benchmark PRIVATE Kokkos::kokkos)

find_package(resilience REQUIRED)
target_link_libraries(heatdis_resil PRIVATE Kokkos::resilience)
target_link_libraries(heatdis_restart_resil PRIVATE Kokkos::resilience)
target_link_libraries(heatdis_synthesis_benchmark PRIVATE Kokkos::resilience)

find_package(VeloC REQUIRED)
target_link_libraries(heatdis_veloc PRIVATE veloc::veloc)
target_link_libraries(heatdis_restart_veloc PRIVATE veloc::veloc)

add_subdirectory(tpl)

# Install rules
include(GNUInstallDirs)

install(TARGETS heatdis_resil heatdis_veloc heatdis_restart_resil heatdis_restart_veloc)
install(TARGETS heatdis_resil heatdis_veloc heatdis_synthesis_benchmark)
102 changes: 53 additions & 49 deletions cmake/Modules/FindVeloC.cmake
Original file line number Diff line number Diff line change
@@ -1,106 +1,110 @@
find_package(MPI)

find_path(_veloc_root
NAMES include/veloc.h
HINTS $ENV{VeloC_ROOT} ${VeloC_ROOT} ${VeloC_DIR}
)
NAMES include/veloc.h
HINTS $ENV{VeloC_ROOT} ${VeloC_ROOT} ${VeloC_DIR}
)

find_library(_veloc_client_lib
#NAMES libveloc.a veloc libveloc-client.so
NAMES libveloc-client.a veloc libveloc-client.so
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)
NAMES libveloc.a veloc libveloc-client.so libveloc-client.dylib
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)

find_library(_veloc_module_lib
#NAMES libveloc.a veloc libveloc-modules.so
NAMES libveloc-modules.a veloc libveloc-modules.so
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)
NAMES libveloc.a veloc libveloc-modules.so libveloc-modules.dylib
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)

find_library(_veloc_axl
NAMES libaxl.a axl
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)
NAMES libaxl.a axl
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)

find_library(_veloc_er
NAMES liber.a er
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)
NAMES liber.a er
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)

find_library(_veloc_rankstr
NAMES librankstr.a rankstr
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)
NAMES librankstr.a rankstr
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)

find_library(_veloc_kvtree
NAMES libkvtree.a kvtree
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)
NAMES libkvtree.a kvtree
HINTS ${_veloc_root}/lib ${_veloc_root}/lib64)

find_path(_veloc_include_dir
NAMES veloc.h
HINTS ${_veloc_root}/include)
NAMES veloc.h
HINTS ${_veloc_root}/include)

if ((NOT ${_veloc_root})
OR (NOT ${_veloc_client_lib})
OR (NOT ${_veloc_module_lib})
OR (NOT ${_veloc_include_dir}))
OR (NOT ${_veloc_client_lib})
OR (NOT ${_veloc_module_lib})
OR (NOT ${_veloc_include_dir}))
set(_fail_msg "Could NOT find VeloC (set VeloC_DIR or VeloC_ROOT to point to install)")
else()
set(_fail_msg "Could NOT find VeloC")
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(VeloC ${_fail_msg}
_veloc_root
_veloc_client_lib
_veloc_module_lib
_veloc_include_dir
MPI_FOUND
MPI_CXX_FOUND
)

if (NOT VELOC_BAREBONE)
_veloc_root
_veloc_client_lib
_veloc_module_lib
_veloc_include_dir
MPI_FOUND
MPI_CXX_FOUND
)

if (NOT TARGET veloc::axl)
add_library(veloc::axl UNKNOWN IMPORTED)
set_target_properties(veloc::axl PROPERTIES
IMPORTED_LOCATION ${_veloc_axl}
)
IMPORTED_LOCATION ${_veloc_axl}
)
endif()

if (NOT TARGET veloc::er)
add_library(veloc::er UNKNOWN IMPORTED)
set_target_properties(veloc::er PROPERTIES
IMPORTED_LOCATION ${_veloc_er}
)
IMPORTED_LOCATION ${_veloc_er}
)
endif()

if (NOT TARGET veloc::rankstr)
add_library(veloc::rankstr UNKNOWN IMPORTED)
set_target_properties(veloc::rankstr PROPERTIES
IMPORTED_LOCATION ${_veloc_rankstr}
)
IMPORTED_LOCATION ${_veloc_rankstr}
)
endif()

if (NOT TARGET veloc::kvtree)
add_library(veloc::kvtree UNKNOWN IMPORTED)
set_target_properties(veloc::kvtree PROPERTIES
IMPORTED_LOCATION ${_veloc_rankstr}
)
IMPORTED_LOCATION ${_veloc_rankstr}
)
endif()

if (NOT TARGET veloc::veloc_modules)
add_library(veloc::veloc_modules UNKNOWN IMPORTED)
set_target_properties(veloc::veloc_modules PROPERTIES
IMPORTED_LOCATION ${_veloc_module_lib}
)
IMPORTED_LOCATION ${_veloc_module_lib}
)
endif()

if (NOT TARGET veloc::veloc)
add_library(veloc::veloc UNKNOWN IMPORTED)
set_target_properties(veloc::veloc PROPERTIES
IMPORTED_LOCATION ${_veloc_client_lib}
INTERFACE_INCLUDE_DIRECTORIES ${_veloc_include_dir}
INTERFACE_LINK_LIBRARIES "veloc::veloc_modules;MPI::MPI_CXX"
)
IMPORTED_LOCATION ${_veloc_client_lib}
INTERFACE_INCLUDE_DIRECTORIES ${_veloc_include_dir}
INTERFACE_LINK_LIBRARIES "veloc::veloc_modules;MPI::MPI_CXX"
)
endif()

if (NOT VELOC_BAREBONE)
set_target_properties(veloc::veloc PROPERTIES
INTERFACE_LINK_LIBRARIES "veloc::axl;veloc::er;veloc::rankstr"
)
INTERFACE_LINK_LIBRARIES "veloc::axl;veloc::er;veloc::rankstr"
)
endif()

set(VeloC_DIR ${_veloc_root})

mark_as_advanced(
_veloc_library
_veloc_include_dir
_veloc_library
_veloc_include_dir
)
12 changes: 2 additions & 10 deletions src/heatdis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,9 @@ target_sources(heatdis_resil PRIVATE
)
target_sources(heatdis_veloc PRIVATE
heatdis.cpp
veloc-main.cpp
veloc_main.cpp
)
target_sources(benchmark_veloc PRIVATE
target_sources(heatdis_synthesis_benchmark PRIVATE
heatdis.cpp
veloc-synthesis-bench.cpp
)
target_sources(heatdis_restart_resil PRIVATE
heatdis.cpp
restart_main.cpp
)
target_sources(heatdis_restart_veloc PRIVATE
heatdis.cpp
veloc_restart.cpp
)
27 changes: 26 additions & 1 deletion src/heatdis/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#include "heatdis.hpp"
#include <resilience/CheckpointFilter.hpp>

/* Added to test restart */
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>

using namespace heatdis;

/*
Expand All @@ -23,6 +28,8 @@ int main(int argc, char *argv[]) {
("n,nsteps", "Number of timesteps", cxxopts::value<std::size_t>()->default_value("600"))
("p,precision", "Min precision", cxxopts::value<double>()->default_value("0.00001"))
("c,checkpoint-interval", "Checkpoint interval", cxxopts::value<int>()->default_value("100"))
("fail", "Fail iteration or negative for no fail", cxxopts::value<int>()->default_value("-1"))
("fail-rank", "Rank to fail if failing", cxxopts::value<int>()->default_value("0"))
("config", "Config file", cxxopts::value<std::string>())
("scale", "Weak or strong scaling", cxxopts::value<std::string>())
;
Expand All @@ -33,6 +40,8 @@ int main(int argc, char *argv[]) {
std::size_t nsteps = args["nsteps"].as< std::size_t >();
const auto precision = args["precision"].as< double >();
const auto chk_interval = args["checkpoint-interval"].as< int >();
const int fail_iter = args["fail"].as< int >();
const int fail_rank = args["fail-rank"].as< int >();

int strong, str_ret;

Expand Down Expand Up @@ -66,6 +75,7 @@ int main(int argc, char *argv[]) {
/* weak scaling */
M = (int)sqrt((double)(mem_size * 1024.0 * 1024.0 * nbProcs) / (2 * sizeof(double))); // two matrices needed
nbLines = (M / nbProcs) + 3;

} else {

/* strong scaling */
Expand All @@ -80,6 +90,9 @@ int main(int argc, char *argv[]) {

memSize = M * nbLines * 2 * sizeof(double) / (1024 * 1024);

// printf("nbProcs: %d\n", nbProcs);
// printf("size of double: %d\n", sizeof(double));

if (rank == 0)
if (!strong) {
printf("Local data size is %d x %d = %f MB (%lu).\n", M, nbLines, memSize, mem_size);
Expand All @@ -92,7 +105,13 @@ int main(int argc, char *argv[]) {
printf("Maximum number of iterations : %lu \n", nsteps);

wtime = MPI_Wtime();
int i = 1 + KokkosResilience::latest_version(*ctx, "test_kokkos");
//int i = 1 + KokkosResilience::latest_version(*ctx, "test_kokkos");
int i = KokkosResilience::latest_version(*ctx, "test_kokkos");
int v = i;
printf("i: %d --- v: %d\n", i, v);
if (i < 0) {
i = 0;
}

while(i < nsteps) {

Expand All @@ -113,6 +132,12 @@ int main(int argc, char *argv[]) {
break;
}
i++;

// if (rank == 0 && i == 301 && v < 0) {
if ((fail_iter >= 0 ) && (rank == fail_rank) && (i == fail_iter) && (v < 0)) {
printf("Killing rank %d at i == %d.\n", rank, i);
MPI_Abort(MPI_COMM_WORLD, 400);
}
}
if (rank == 0)
printf("Execution finished in %lf seconds.\n", MPI_Wtime() - wtime);
Expand Down
Loading

0 comments on commit 3133b96

Please sign in to comment.