95 lines
2.6 KiB
Makefile
95 lines
2.6 KiB
Makefile
#
|
|
# Arquiteturas de Alto Desempenho 2025/2026
|
|
#
|
|
# makefile for the first practical assignment (A1)
|
|
#
|
|
# makefile automatic variables:
|
|
# $@ is the name of the target
|
|
# $< is the name of the first prerequisite
|
|
# $^ is the list of names of all prerequisites (without duplicates)
|
|
#
|
|
|
|
#
|
|
# CUDA installation directory --- /usr/local/cuda or $(CUDA_HOME)
|
|
#
|
|
|
|
CUDA_DIR = /opt/cuda
|
|
|
|
|
|
#
|
|
# OpenCL installation directory (for a NVidia graphics card, sama as CUDA)
|
|
#
|
|
|
|
OPENCL_DIR = $(CUDA_DIR)
|
|
|
|
|
|
#
|
|
# CUDA device architecture
|
|
#
|
|
# GeForce GTX 1660 Ti --- sm_75
|
|
# RTX A2000 Ada --------- sm_86
|
|
# RTX A6000 Ada --------- sm_86
|
|
# RTX 4070 -------------- sm_89
|
|
#
|
|
|
|
CUDA_ARCH = sm_86
|
|
|
|
|
|
#
|
|
# clean up
|
|
#
|
|
|
|
clean:
|
|
rm -f sha1_tests
|
|
rm -f sha1_cuda_test sha1_cuda_kernel.cubin
|
|
rm -f coin_miner_cpu coin_miner_simd coin_miner_cuda coin_miner_cuda_kernel.cubin
|
|
rm -f benchmark
|
|
rm -f a.out
|
|
|
|
|
|
#
|
|
# test the CUSTOM_SHA1_CODE macro
|
|
#
|
|
|
|
sha1_tests: aad_sha1_cpu_tests.c aad_sha1.h aad_data_types.h aad_utilities.h makefile
|
|
cc -march=native -Wall -Wshadow -Werror -O3 $< -o $@
|
|
|
|
sha1_cuda_test: aad_sha1_cuda_test.c sha1_cuda_kernel.cubin aad_sha1.h aad_data_types.h aad_utilities.h aad_cuda_utilities.h makefile
|
|
cc -march=native -Wall -Wshadow -Werror -O3 -I$(CUDA_DIR)/include $< -o $@ -lcuda
|
|
|
|
|
|
#
|
|
# compile the CUDA kernels
|
|
#
|
|
|
|
sha1_cuda_kernel.cubin: aad_sha1_cuda_kernel.cu aad_sha1.h makefile
|
|
nvcc -arch=$(CUDA_ARCH) --compiler-options -O2,-Wall -I$(CUDA_DIR)/include --cubin $< -o $@
|
|
|
|
all: sha1_tests sha1_cuda_test sha1_cuda_kernel.cubin
|
|
|
|
|
|
#
|
|
# DETI coin miners
|
|
#
|
|
|
|
coin_miner_cpu: aad_coin_miner_cpu.c aad_sha1.h aad_sha1_cpu.h aad_data_types.h aad_utilities.h aad_vault.h makefile
|
|
cc -march=native -Wall -Wshadow -Werror -O3 $< -o $@
|
|
|
|
coin_miner_simd: aad_coin_miner_simd.c aad_sha1.h aad_sha1_cpu.h aad_data_types.h aad_utilities.h aad_vault.h makefile
|
|
cc -march=native -Wall -Wshadow -Werror -fopenmp -mavx2 -O3 $< -o $@
|
|
|
|
coin_miner_cuda_kernel.cubin: aad_coin_miner_cuda_kernel.cu aad_sha1.h makefile
|
|
nvcc -arch=$(CUDA_ARCH) --compiler-options -O2,-Wall -I$(CUDA_DIR)/include --cubin $< -o $@
|
|
|
|
coin_miner_cuda: aad_coin_miner_cuda.c coin_miner_cuda_kernel.cubin aad_sha1.h aad_sha1_cpu.h aad_data_types.h aad_utilities.h aad_vault.h aad_cuda_utilities.h makefile
|
|
cc -march=native -Wall -Wshadow -Werror -O3 -I$(CUDA_DIR)/include $< -o $@ -lcuda
|
|
|
|
benchmark: aad_benchmark.c aad_sha1.h aad_sha1_cpu.h aad_data_types.h aad_utilities.h makefile
|
|
cc -march=native -Wall -Wshadow -Werror -O3 $< -o $@
|
|
|
|
miners: coin_miner_cpu coin_miner_simd coin_miner_cuda benchmark
|
|
|
|
all: sha1_tests sha1_cuda_test sha1_cuda_kernel.cubin \
|
|
coin_miner_cpu coin_miner_simd coin_miner_cuda coin_miner_cuda_kernel.cubin \
|
|
benchmark
|