Skip to content

Commit

Permalink
improve autotuner
Browse files Browse the repository at this point in the history
  • Loading branch information
xspanger3770 committed Apr 18, 2024
1 parent 9c6d12b commit 894b5ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions GQHypocenterSearch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ if(NOT DEFINED TILE)
set(TILE ${TILE_DEFAULT})
endif()

if(NOT DEFINED TESTS)
set(TESTS_DEFAULT 16)
set(TESTS ${TESTS_DEFAULT})
endif()

# Add definitions for CUDA_NVCC_FLAGS based on BLOCK_HYPOCS and TILE
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} $ENV{CUDA_NVCC_FLAGS} --use_fast_math -DBLOCK_HYPOCS=${BLOCK_HYPOCS} -DTILE=${TILE}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBLOCK_HYPOCS=${BLOCK_HYPOCS} -DTILE=${TILE}")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} $ENV{CUDA_NVCC_FLAGS} --use_fast_math -DTESTS=${TESTS} -DBLOCK_HYPOCS=${BLOCK_HYPOCS} -DTILE=${TILE}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBLOCK_HYPOCS=${BLOCK_HYPOCS} -DTESTS=${TESTS} -DTILE=${TILE}")

# Find CUDA package
find_package(CUDA REQUIRED)
Expand Down
5 changes: 4 additions & 1 deletion GQHypocenterSearch/autotune.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
BLOCK_HYPOCS_VALUES=(32 64 128 224 256 264 280 324 360 384 442 512 1024)
TILE_VALUES=(1 2 3 4 5 6 7 8 10 12)

DEFAULT_TESTS=12
TESTS=${1:-$DEFAULT_TESTS}

filename="autotune_results.csv"

# Remove the existing file if it exists
Expand All @@ -22,7 +25,7 @@ for BLOCK_HYPOCS in "${BLOCK_HYPOCS_VALUES[@]}"; do
# Loop over TILE values
for TILE in "${TILE_VALUES[@]}"; do
# Run cmake with specified BLOCK_HYPOCS and TILE values
cmake -DBLOCK_HYPOCS=$BLOCK_HYPOCS -DTILE=$TILE ..
cmake -DBLOCK_HYPOCS=$BLOCK_HYPOCS -DTILE=$TILE -DTESTS=$TESTS ..

# Compile the project using make
make
Expand Down
2 changes: 1 addition & 1 deletion GQHypocenterSearch/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main() {

float final_result[4];

int tests = 2;
int tests = TESTS;

double best_pps = 0;

Expand Down

0 comments on commit 894b5ce

Please sign in to comment.