-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
59 lines (46 loc) · 2.27 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 3.14)
project(hw2 LANGUAGES C CXX)
set(CMAKE_BUILD_TYPE "Release")
find_package(BLAS REQUIRED)
find_package(MPI REQUIRED)
# We require the GNU compiler for this assignment.
if (NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(Prg-Intel "PrgEnv-intel")
set(Prg-Clang "PrgEnv-cray")
message(WARNING
"Must use GNU Compiler for submission. Make sure you ran:\n"
"module swap ${Prg-${CMAKE_C_COMPILER_ID}} PrgEnv-gnu")
endif ()
# Common library target for benchmarking.
add_library(benchmark OBJECT benchmark.cpp)
#target_compile_features(benchmark PRIVATE cxx_std_11)
target_compile_options(benchmark PRIVATE -fopenmp -march=native)
add_executable(benchmark-basic-omp dgemm-basic-omp.cpp)
target_link_libraries(benchmark-basic-omp PRIVATE benchmark ${BLAS_LIBRARIES})
target_link_options(benchmark-basic-omp PRIVATE -fopenmp)
#target_compile_features(benchmark-basic-omp PRIVATE c_std_11 c_restrict)
target_compile_options(benchmark-basic-omp PRIVATE -fopenmp -Wall -pedantic -march=native)
set(BENCHMARK "basic-omp")
configure_file(job.in job-${BENCHMARK})
add_executable(benchmark-blas dgemm-blas.cpp)
target_link_libraries(benchmark-blas PRIVATE benchmark ${BLAS_LIBRARIES})
target_link_options(benchmark-blas PRIVATE -fopenmp)
target_compile_features(benchmark-blas PRIVATE c_std_11 c_restrict)
target_compile_options(benchmark-blas PRIVATE -Wall -pedantic -march=native)
set(BENCHMARK "blas")
configure_file(job.in job-${BENCHMARK})
add_executable(benchmark-blocked-omp dgemm-blocked-omp.cpp)
add_library(bench-blocked-omp OBJECT benchmark.cpp)
target_compile_definitions(bench-blocked-omp PRIVATE -DBLOCKED)
target_compile_options(bench-blocked-omp PRIVATE -fopenmp)
target_link_libraries(benchmark-blocked-omp PRIVATE bench-blocked-omp ${BLAS_LIBRARIES})
target_link_options(benchmark-blocked-omp PRIVATE -fopenmp)
target_compile_options(benchmark-blocked-omp PRIVATE -fopenmp -Wall -pedantic -march=native)
set(BENCHMARK "blocked-omp")
configure_file(job.in job-${BENCHMARK})
add_executable(mpi_2dmesh mpi_2dmesh.cpp)
# include directories
target_include_directories(mpi_2dmesh PRIVATE ${MPI_C_INCLUDE_PATH} ${MPI_CXX_INCLUDE_PATH})
# link libraries
target_link_libraries(mpi_2dmesh PRIVATE ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES})
# eof