Merge branch 'master' into cmakelist_rewrite_and_C_API_conformity_07-26

This commit is contained in:
jpekkila
2019-08-06 17:53:53 +03:00
16 changed files with 758 additions and 398 deletions

49
scripts/autotest.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
# Usage:
# cd astaroth
# source ./sourceme.sh
# autotest.sh
#
# If you need slurm or to pass something before ./ac_run, set the variable
# SRUN_COMMAND before calling this script.
#
# F.ex. on Taito SRUN_COMMAND="srun --gres=gpu:k80:4 --mem=24000 -t 00:14:59 -p gputest --cpus-per-task 1 -n 1"
results=()
# Parameters
# $1: String testname
# $2: String stencil_define_file
# $3: String stencil_assembly_file
# $4: String stencil_process_file
test_solver() {
TEST_DIR="tests/"$1
ac_mkbuilddir.sh -b ${TEST_DIR}
cd ${TEST_DIR}
compile_acc.sh --header $2 --assembly $3 --process $4
make -j
${SRUN_COMMAND} ./ac_run -t
results+=(${TEST_DIR}" fail? "$?)
}
NAME="hydro"
HEADER="hydro_solver/stencil_defines.h"
ASSEMBLY="mhd_solver/stencil_assembly.sas"
PROCESS="mhd_solver/stencil_process.sps"
test_solver ${NAME} ${HEADER} ${ASSEMBLY} ${PROCESS}
NAME="magnetic"
HEADER="magnetic_solver/stencil_defines.h"
ASSEMBLY="mhd_solver/stencil_assembly.sas"
PROCESS="mhd_solver/stencil_process.sps"
test_solver ${NAME} ${HEADER} ${ASSEMBLY} ${PROCESS}
NAME="mhd"
HEADER="mhd_solver/stencil_defines.h"
ASSEMBLY="mhd_solver/stencil_assembly.sas"
PROCESS="mhd_solver/stencil_process.sps"
test_solver ${NAME} ${HEADER} ${ASSEMBLY} ${PROCESS}
# Print results
for i in "${results[@]}"; do echo "$i" ; done

View File

@@ -1,3 +0,0 @@
#!/bin/bash
cmake -DCUDA_BUILD_LEGACY=OFF -DDOUBLE_PRECISION=ON .. && make -j && valgrind --leak-check=full --show-leak-kinds=all ./ac_run -t && make clean &&\
cmake -DCUDA_BUILD_LEGACY=OFF -DDOUBLE_PRECISION=OFF .. && make -j && valgrind --leak-check=full --show-leak-kinds=all ./ac_run -t

View File

@@ -1,9 +0,0 @@
#!/bin/bash
if [[ $1 == "DO" && $2 == "IT!" ]]; then
find -name \*.h -o -name \*.cc -o -name \*.cu -o -name \*.cuh | xargs clang-format-6.0 -i -style=file
echo "It is done."
else
find -name \*.h -o -name \*.cc -o -name \*.cu -o -name \*.cuh
echo "I'm going to try to fix the style of these files."
echo "If you're absolutely sure, give \"DO IT!\" (without quotes) as a parameter."
fi

View File

@@ -1,60 +0,0 @@
/*
Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae.
This file is part of Astaroth.
Astaroth is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Astaroth is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Astaroth. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file
* \brief Generates a threadblock config file for RK3 using the given parameters.
*
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
const char* rk3_threadblockconf_path = "rk3_threadblock.conf";
int
write_to_file(int threads_x, int threads_y, int threads_z, int elems_per_thread, int launch_bound)
{
FILE* fp;
fp = fopen(rk3_threadblockconf_path, "w");
if (fp != NULL) {
fprintf(fp, "#define RK_THREADS_X (%d)\n", threads_x);
fprintf(fp, "#define RK_THREADS_Y (%d)\n", threads_y);
fprintf(fp, "#define RK_THREADS_Z (%d)\n", threads_z);
fprintf(fp, "#define RK_ELEMS_PER_THREAD (%d)\n", elems_per_thread);
fprintf(fp, "#define RK_LAUNCH_BOUND_MIN_BLOCKS (%d)\n", launch_bound);
fclose(fp);
return EXIT_SUCCESS;
}
return EXIT_FAILURE;
}
// Takes arguments and writes them into a file
// RK_THREADS_X, RK_THREADS_Y, RK_THREADS_Z, RK_ELEMS_PER_THREAD, RK_LAUNCH_BOUND_MIN_BLOCKS
int
main(int argc, char* argv[])
{
assert(argc == 6);
return write_to_file(atoi(argv[1]), atoi(argv[2]),atoi(argv[3]), atoi(argv[4]), atoi(argv[5]));
}

View File

@@ -1,2 +0,0 @@
#!/bin/bash
doxygen doxyfile