1
Fork 0
mirror of https://github.com/Steffo99/unimore-hpc-assignments.git synced 2025-02-16 17:13:57 +00:00

Configure makefile to use nvcc

This commit is contained in:
Steffo 2022-11-28 14:37:37 +01:00
parent be3a4ec301
commit a2a070bb3a
Signed by: steffo
GPG key ID: 6965406171929D01
4 changed files with 30 additions and 19 deletions

View file

@ -20,30 +20,30 @@ for dataset in MINI_DATASET SMALL_DATASET STANDARD_DATASET LARGE_DATASET EXTRALA
do
for c in $(seq 0 15)
do
cflags="-D$dataset"
cxxflags="-D$dataset"
if (( $c & 1 ))
then
cflags="$cflags -DTOGGLE_INIT_ARRAY_1"
cxxflags="$cxxflags -DTOGGLE_INIT_ARRAY_1"
fi
if (( $c & 2 ))
then
cflags="$cflags -DTOGGLE_INIT_ARRAY_2"
cxxflags="$cxxflags -DTOGGLE_INIT_ARRAY_2"
fi
if (( $c & 4 ))
then
cflags="$cflags -DTOGGLE_KERNEL_ATAX_1"
cxxflags="$cxxflags -DTOGGLE_KERNEL_ATAX_1"
fi
if (( $c & 8 ))
then
cflags="$cflags -DTOGGLE_KERNEL_ATAX_2"
cxxflags="$cxxflags -DTOGGLE_KERNEL_ATAX_2"
fi
echo "Flags: $cflags"
make "EXTRA_CFLAGS=$cflags" clean all
echo "Flags: $cxxflags"
make "EXTRA_CXXFLAGS=$cxxflags" clean all
run_benchmarks
done

View file

@ -1,21 +1,32 @@
-include ../../../utilities/options.mk
-include ../../../utilities/c2.mk
# -DPOLYBENCH_TIME makes Polybench output the execution time of the program
CFLAGS+= -DPOLYBENCH_TIME
# -Wall and -Wextra enable more warnings
CFLAGS+= -Wall
CFLAGS+= -Wextra
# -O3 applies all compiler optimization, improving from 800ms to 300ms
CFLAGS+= -O3
# -DTHREAD_COUNT allows us to alter the number of threads used in the whole file
CFLAGS+= -DTHREAD_COUNT=4
# Extend CFLAGS with command line parameters
CFLAGS+= ${EXTRA_CFLAGS}
# Disable make output
MAKEFLAGS+= --silent
# -DPOLYBENCH_TIME makes Polybench output the execution time of the program
CXXFLAGS+= -DPOLYBENCH_TIME
# -Wall and -Wextra enable more warnings
CXXFLAGS+= -Wall
CXXFLAGS+= -Wextra
# -O3 applies all compiler optimization, improving from 800ms to 300ms
CXXFLAGS+= -O3
# Extend CFLAGS with command line parameters
CXXFLAGS+= ${EXTRA_CXXFLAGS}
# Select the location of the local CUDA install
CUDA_HOME:=/opt/cuda
# Specify the directory of the nvc compiler
NVCC=$(CUDA_HOME)/bin/nvcc
# Specify the flags for the nvc compiler
NVCFLAGS:=$(CXXFLAGS) $(NVOPT)
# Create an automake definition for .cu files
$(BUILD_DIR)/%.cu.o: %.cu
$(MKDIR_P) $(dir $@)
$(NVCC) $(NVCFLAGS) -c $< -o $@
.PHONY: bench

View file

@ -8,7 +8,7 @@
/* Include benchmark-specific header. */
/* Default data type is double, default size is 4000. */
#include "atax.h"
#include "atax.hu"
// Workaround for the editor not finding M_PI
// It is exclusive to the GNU C compiler