Added missing files
This commit is contained in:
8
samples/genbenchmarkscripts/CMakeLists.txt
Normal file
8
samples/genbenchmarkscripts/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
add_executable(genbenchmarkscripts main.c)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
TARGET genbenchmarkscripts POST_BUILD
|
||||||
|
COMMAND genbenchmarkscripts
|
||||||
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||||
|
COMMENT "Generating benchmark scripts"
|
||||||
|
)
|
46
samples/genbenchmarkscripts/main.c
Normal file
46
samples/genbenchmarkscripts/main.c
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#include <assert.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
const int max_nprocs = 128;
|
||||||
|
for (int nprocs = 1; nprocs <= max_nprocs; nprocs *= 2) {
|
||||||
|
char filename[4096];
|
||||||
|
sprintf(filename, "benchmark_%d.sh", nprocs);
|
||||||
|
|
||||||
|
FILE* fp = fopen(filename, "w");
|
||||||
|
assert(fp);
|
||||||
|
|
||||||
|
// Boilerplate
|
||||||
|
fprintf(fp, "#!/bin/bash\n");
|
||||||
|
fprintf(fp, "#BATCH --job-name=astaroth\n");
|
||||||
|
fprintf(fp, "#SBATCH --account=project_2000403\n");
|
||||||
|
fprintf(fp, "#SBATCH --time=00:14:59\n");
|
||||||
|
fprintf(fp, "#SBATCH --mem=24000\n");
|
||||||
|
fprintf(fp, "#SBATCH --partition=gputest\n");
|
||||||
|
|
||||||
|
// nprocs, nodes, gpus
|
||||||
|
const int max_gpus_per_node = 4;
|
||||||
|
const int gpus_per_node = nprocs < max_gpus_per_node ? nprocs : max_gpus_per_node;
|
||||||
|
const int nodes = (int)ceil((double)nprocs / max_gpus_per_node);
|
||||||
|
fprintf(fp, "#SBATCH --gres=gpu:v100:%d\n", gpus_per_node);
|
||||||
|
fprintf(fp, "#SBATCH -n %d\n", nprocs);
|
||||||
|
fprintf(fp, "#SBATCH -N %d\n", nodes);
|
||||||
|
|
||||||
|
// Modules
|
||||||
|
fprintf(fp, "module load gcc/8.3.0 cuda/10.1.168 cmake hpcx-mpi/2.5.0-cuda nccl\n");
|
||||||
|
fprintf(fp, "export UCX_MEMTYPE_CACHE=n\n");
|
||||||
|
|
||||||
|
// Profile and run
|
||||||
|
fprintf(fp, "mkdir -p profile_%d\n", nprocs);
|
||||||
|
fprintf(fp, "srun nvprof --annotate-mpi openmpi -o profile_%d/%%p.nvprof ./benchmark\n",
|
||||||
|
nprocs);
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
@@ -1,11 +1,14 @@
|
|||||||
|
find_package(CUDAToolkit)
|
||||||
|
|
||||||
## Astaroth Core
|
## Astaroth Core
|
||||||
add_library(astaroth_core STATIC device.cc node.cc astaroth.cc)
|
add_library(astaroth_core STATIC device.cc node.cc astaroth.cc)
|
||||||
target_link_libraries(astaroth_core astaroth_utils astaroth_kernels cudart)
|
target_link_libraries(astaroth_core astaroth_utils astaroth_kernels CUDA::cudart_static)
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
if (MPI_ENABLED)
|
if (MPI_ENABLED)
|
||||||
find_package(MPI)
|
find_package(MPI)
|
||||||
target_link_libraries(astaroth_core MPI::MPI_CXX)
|
find_package(OpenMP)
|
||||||
|
target_link_libraries(astaroth_core MPI::MPI_CXX OpenMP::OpenMP_CXX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (MULTIGPU_ENABLED)
|
if (MULTIGPU_ENABLED)
|
||||||
|
Reference in New Issue
Block a user