| 1 |
# ======================================================================================= |
| 2 |
# |
| 3 |
# Filename: Makefile |
| 4 |
# |
| 5 |
# Description: test Makefile |
| 6 |
# |
| 7 |
# Version: <VERSION> |
| 8 |
# Released: <DATE> |
| 9 |
# |
| 10 |
# Author: Jan Treibig (jt), [email protected] |
| 11 |
# Thomas Gruber (tr), [email protected] |
| 12 |
# |
| 13 |
# Project: likwid |
| 14 |
# |
| 15 |
# Copyright (C) 2016 RRZE, University Erlangen-Nuremberg |
| 16 |
# |
| 17 |
# This program is free software: you can redistribute it and/or modify it under |
| 18 |
# the terms of the GNU General Public License as published by the Free Software |
| 19 |
# Foundation, either version 3 of the License, or (at your option) any later |
| 20 |
# version. |
| 21 |
# |
| 22 |
# This program is distributed in the hope that it will be useful, but WITHOUT ANY |
| 23 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 24 |
# PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 25 |
# |
| 26 |
# You should have received a copy of the GNU General Public License along with |
| 27 |
# this program. If not, see <http://www.gnu.org/licenses/>. |
| 28 |
# |
| 29 |
# ======================================================================================= |
| 30 |
|
| 31 |
include ../config.mk |
| 32 |
|
| 33 |
LIKWID_LIB ?= -L$(PREFIX)/lib |
| 34 |
LIKWID_INC ?= -I$(PREFIX)/include |
| 35 |
LIKWID_DEFINES ?= -DLIKWID_PERFMON |
| 36 |
HIPCC ?= $(ROCM_HOME)/hip/bin/hipcc |
| 37 |
|
| 38 |
all: targets |
| 39 |
|
| 40 |
GCC_C11_SUPPORT_MAJOR=$(shell /bin/bash -c "g++ -v 2>&1 | grep -o -E '([0-9])\.' | head -n 1 | tr -d '[:punct:]'") |
| 41 |
GCC_C11_SUPPORT_MINOR=$(shell /bin/bash -c "g++ -v 2>&1 | grep -o -E '\.([0-9])\.' | head -n 1 | tr -d '[:punct:]'") |
| 42 |
ICC_AVAILABLE=$(shell /bin/bash -c "which icc | wc -l") |
| 43 |
ICPC_AVAILABLE=$(shell /bin/bash -c "which icpc | wc -l") |
| 44 |
TBB_AVAILABLE=$(shell /bin/bash -c "ldconfig -v 2>/dev/null | grep libtbb.so | wc -l") |
| 45 |
|
| 46 |
targets: |
| 47 |
@echo "Please specify a build target:" |
| 48 |
@echo " - streamGCC (STREAM-like code with multiple MarkerAPI regions compiled with GCC OpenMP)" |
| 49 |
@echo " - streamICC (STREAM-like code with multiple MarkerAPI regions compiled with Intel C Compiler OpenMP if available)" |
| 50 |
@echo " - streamAPIGCC (STREAM-like code using the LikwidAPI compiled with GCC OpenMP)" |
| 51 |
@echo " - streamGCC_C11 (STREAM-like code with multiple MarkerAPI regions using C++11 threads compiled with GCC)" |
| 52 |
@echo " - streamICC_C11 (STREAM-like code with multiple MarkerAPI regions using C++11 threads compiled with Intel C Compiler)" |
| 53 |
@echo " - stream_cilk (STREAM-like code with Cilk+)" |
| 54 |
@echo " - streamCU (STREAM-like code in CUDA implementation and NvMarkerAPI)" |
| 55 |
@echo "" |
| 56 |
@echo " - jacobi-2D-5pt-gcc (2D Jacobi 5pt stencil compiled with GCC OpenMP)" |
| 57 |
@echo " - jacobi-2D-5pt-icc (2D Jacobi 5pt stencil compiled with Intel C Compiler OpenMP)" |
| 58 |
@echo "" |
| 59 |
@echo " - serial (Serial code computing power 2 of a vector)" |
| 60 |
@echo " - test-likwidAPI (LikwidAPI test suite)" |
| 61 |
@echo " - testmarker-cnt (Test code with code regions executed with different loop counts)" |
| 62 |
@echo " - testmarker-omp (Test code with code regions for OpenMP loops)" |
| 63 |
@echo " - testmarkerF90 (Fortran90 test code with multiple regions compiled with Intel Fortran Compiler)" |
| 64 |
@echo " - test-mpi (MPI pinning test code with OpenMP)" |
| 65 |
@echo " - test-mpi-pthreads (MPI pinning test code with Pthreads)" |
| 66 |
@echo " - testTBBGCC (Intel TBB test code compiled with GCC)" |
| 67 |
@echo " - testTBBICC (Intel TBB test code compiled with Intel C++ Compiler)" |
| 68 |
@echo " - triadCU (Vector triad benchmark code in CUDA implementation and NvMarkerAPI)" |
| 69 |
@echo " - test_sysFeatures (Test experimental sysFeatures API if configured)" |
| 70 |
@echo "" |
| 71 |
@echo " - clean (Clean all compiled files)" |
| 72 |
|
| 73 |
jacobi-2D-5pt-gcc: jacobi-2D-5pt.c |
| 74 |
gcc -O3 -std=c99 -fopenmp $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ jacobi-2D-5pt.c -lm -llikwid |
| 75 |
|
| 76 |
streamGCC: stream.c |
| 77 |
gcc -O3 -std=c99 -fopenmp $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ stream.c -lm -llikwid |
| 78 |
|
| 79 |
streamAPIGCC: stream-API.c |
| 80 |
gcc -O3 -std=c99 -fopenmp -ftree-vectorize -ffast-math $(LIKWID_INC) $(LIKWID_LIB) -o $@ stream-API.c -lm -llikwid |
| 81 |
|
| 82 |
serial: serial.c |
| 83 |
gcc -O3 -std=c99 $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ serial.c -lm -llikwid |
| 84 |
|
| 85 |
test-likwidAPI: test-likwidAPI.c |
| 86 |
gcc -O3 -std=c99 $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ test-likwidAPI.c -lm -llikwid |
| 87 |
|
| 88 |
test-msr-access: test-msr-access.c |
| 89 |
gcc -o $@ test-msr-access.c |
| 90 |
|
| 91 |
test-topology-gpu-rocm: test-topology-gpu-rocm.c |
| 92 |
gcc -O3 -std=c99 $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -DLIKWID_WITH_ROCMON -o $@ test-topology-gpu-rocm.c -lm -llikwid |
| 93 |
|
| 94 |
test-rocmon-triad: test-rocmon-triad.cpp |
| 95 |
$(HIPCC) -O3 -std=c++11 $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -I$(RSMIINCLUDE) -L$(ROCM_HOME)/rocm_smi/lib -lrocm_smi64 -DLIKWID_WITH_ROCMON test-rocmon-triad.cpp -o $@ -lm -llikwid |
| 96 |
|
| 97 |
test-rocmon-triad-marker: test-rocmon-triad-marker.cpp |
| 98 |
$(HIPCC) -O3 -std=c++11 $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -DLIKWID_WITH_ROCMON -DLIKWID_ROCMON test-rocmon-triad-marker.cpp -o $@ -lm -llikwid |
| 99 |
|
| 100 |
streamICC: stream.c |
| 101 |
if [ $(ICC_AVAILABLE) -ne 0 ]; then icc -O3 -xHost -std=c99 -qopenmp $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ stream.c -lm -llikwid; fi |
| 102 |
|
| 103 |
jacobi-2D-5pt-icc: jacobi-2D-5pt.c |
| 104 |
if [ $(ICC_AVAILABLE) -ne 0 ]; then icc -O3 -xHost -std=c99 -qopenmp $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ jacobi-2D-5pt.c -lm -llikwid; fi |
| 105 |
|
| 106 |
streamGCC_C11: stream.cc |
| 107 |
@if [ $(GCC_C11_SUPPORT_MAJOR) -eq 4 -a $(GCC_C11_SUPPORT_MINOR) -gt 8 ]; then g++ -O3 -std=c++11 -pthread $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ stream.cc -lm -llikwid; fi |
| 108 |
@if [ $(GCC_C11_SUPPORT_MAJOR) -gt 4 ]; then g++ -O3 -std=c++11 -pthread $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ stream.cc -lm -llikwid; fi |
| 109 |
|
| 110 |
streamICC_C11: stream.cc |
| 111 |
@if [ $(ICPC_AVAILABLE) -ne 0 ]; then icpc -restrict -O3 -std=c++11 -pthread $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ stream.cc -lm -llikwid; fi |
| 112 |
|
| 113 |
testmarker-cnt: testmarker-cnt.c |
| 114 |
gcc -O3 -std=c99 -fopenmp $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ testmarker-cnt.c -lm -llikwid |
| 115 |
|
| 116 |
testmarker-omp: testmarker-omp.c |
| 117 |
gcc -O3 -std=c99 -fopenmp $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ testmarker-omp.c -llikwid |
| 118 |
|
| 119 |
testmarkerF90: chaos.F90 |
| 120 |
ifort -O3 $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ chaos.F90 -lpthread -llikwid |
| 121 |
|
| 122 |
test-mpi: MPI_pin_test.c |
| 123 |
mpicc -O2 -fopenmp -D_GNU_SOURCE -o $@ MPI_pin_test.c |
| 124 |
|
| 125 |
test-mpi-pthreads: MPI_pin_test.c |
| 126 |
mpicc -O2 -pthread -DPTHREADS -D_GNU_SOURCE -o $@ MPI_pin_test.c |
| 127 |
|
| 128 |
stream_cilk: stream_cilk.c |
| 129 |
@if [ $(ICC_AVAILABLE) -ne 0 ]; then icc -O3 $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ stream_cilk.c -llikwid; fi |
| 130 |
|
| 131 |
testTBBGCC: |
| 132 |
@if [ $(TBB_AVAILABLE) -ne 0 ]; then g++ -O3 $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ testTBB.cc -ltbb -llikwid; fi |
| 133 |
|
| 134 |
testTBBICC: |
| 135 |
@if [ $(TBB_AVAILABLE) -ne 0 -a $(ICPC_AVAILABLE) -ne 0 ]; then icpc -O3 $(LIKWID_INC) $(LIKWID_DEFINES) $(LIKWID_LIB) -o $@ testTBB.cc -ltbb -llikwid; else echo "Either TBB or ICPC missing"; fi |
| 136 |
|
| 137 |
streamCU: stream.cu |
| 138 |
nvcc -O3 -Xcompiler -fopenmp -I. $(LIKWID_INC) $(LIKWID_LIB) -DLIKWID_NVMON stream.cu -o $@ -lm -llikwid |
| 139 |
|
| 140 |
triadCU: triad.cu |
| 141 |
nvcc -O3 -Xcompiler -fopenmp -I. $(LIKWID_INC) $(LIKWID_LIB) -DLIKWID_NVMON -Xcompiler -fopenmp triad.cu -o $@ -lm -llikwid |
| 142 |
|
| 143 |
ifeq ($(BUILD_SYSFEATURES),true) |
| 144 |
test_sysFeatures: test_sysFeatures.c |
| 145 |
$(CC) -DLIKWID_WITH_SYSFEATURES -I../src/includes -L.. test_sysFeatures.c -o $@ -llikwid |
| 146 |
else |
| 147 |
test_sysFeatures: test_sysFeatures.c |
| 148 |
@echo "Support for sysFeatures not enabled" |
| 149 |
endif |
| 150 |
|
| 151 |
.PHONY: clean distclean streamGCC streamICC streamGCC_C11 streamICC_C11 testmarker-cnt testmarker-omp testmarkerF90 test-mpi test-mpi-pthreads stream_cilk serial test-likwidAPI streamAPIGCC test-msr-access testTBBGCC testTBBICC jacobi-2D-5pt-icc jacobi-2D-5pt-gcc matmul_marker matmul marker_overhead |
| 152 |
|
| 153 |
clean: |
| 154 |
rm -f streamGCC streamICC streamGCC_C11 streamICC_C11 stream_cilk testmarker-cnt testmarkerF90 test-mpi test-mpi-pthreads testmarker-omp serial test-likwidAPI streamAPIGCC test-msr-access testTBBGCC testTBBICC jacobi-2D-5pt-icc jacobi-2D-5pt-gcc matmul_marker matmul marker_overhead streamCU test-topology-gpu-rocm test-rocmon test-rocmon-triad test-rocmon-triad-marker |
| 155 |
|
| 156 |
distclean: clean |