Commit 45355681 authored by Valeriu Codreanu's avatar Valeriu Codreanu
Browse files

Monte Carlo methods pass all compile tests. Modified CMakeLists.txt for all examples

parent 308dd438
# Packages are optional: if they are not present, certain code samples are not compiled
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
find_package(OpenMP) # Built-in in CMake
find_package(MPI) # Built-in in CMake
......@@ -9,6 +11,15 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/common.cmake)
if ("${DWARF_PREFIX}" STREQUAL "")
set(DWARF_PREFIX 7_montecarlo)
endif()
set(NAME1_OMP ${DWARF_PREFIX}_integral1_omp)
set(NAME1_SERIAL ${DWARF_PREFIX}_integral1_serial)
set(NAME1_MPI ${DWARF_PREFIX}_integral1_mpi)
set(NAME2_OMP ${DWARF_PREFIX}_integral2_omp)
set(NAME2_SERIAL ${DWARF_PREFIX}_integral2_serial)
set(NAME2_MPI ${DWARF_PREFIX}_integral2_mpi)
set(NAME3_OMP ${DWARF_PREFIX}_integral3_omp)
set(NAME3_SERIAL ${DWARF_PREFIX}_integral3_serial)
set(NAME3_MPI ${DWARF_PREFIX}_integral3_mpi)
# C compiler settings
......@@ -16,29 +27,35 @@ find_package(Common)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
add_executable(integral1_openmp integral1_openmp.c)
target_link_libraries(integral1_openmp m)
add_executable(integral2_openmp integral2_openmp.c)
target_link_libraries(integral2_openmp m)
add_executable(integral3_openmp integral3_openmp.c)
target_link_libraries(integral3_openmp m)
add_executable(${NAME1_OMP} integral1_openmp.c)
target_link_libraries(${NAME1_OMP} m)
install(TARGETS ${NAME1_OMP} DESTINATION bin)
add_executable(${NAME2_OMP} integral2_openmp.c)
target_link_libraries(${NAME2_OMP} m)
install(TARGETS ${NAME2_OMP} DESTINATION bin)
add_executable(${NAME3_OMP} integral3_openmp.c)
target_link_libraries(${NAME3_OMP} m)
install(TARGETS ${NAME3_OMP} DESTINATION bin)
else()
message("## Skipping 'integral 1/2/3 advanced': no OpenMP support found")
dummy_install(${NAME} "OpenMP")
# dummy_install(${NAME} "OpenMP")
endif()
if (MPI_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
include_directories(${MPI_INCLUDE_PATH})
add_executable(integral1_mpi integral1_mpi.c)
target_link_libraries(integral1_mpi m ${MPI_LIBRARIES})
add_executable(integral2_mpi integral2_mpi.c)
target_link_libraries(integral2_mpi m ${MPI_LIBRARIES})
add_executable(integral3_mpi integral3_mpi.c)
target_link_libraries(integral3_mpi m ${MPI_LIBRARIES})
add_executable(${NAME1_MPI} integral1_mpi.c)
target_link_libraries(${NAME1_MPI} m ${MPI_LIBRARIES} stdc++)
install(TARGETS ${NAME1_MPI} DESTINATION bin)
add_executable(${NAME2_MPI} integral2_mpi.c)
target_link_libraries(${NAME2_MPI} m ${MPI_LIBRARIES} stdc++)
install(TARGETS ${NAME2_MPI} DESTINATION bin)
add_executable(${NAME3_MPI} integral3_mpi.c)
target_link_libraries(${NAME3_MPI} m ${MPI_LIBRARIES} stdc++)
install(TARGETS ${NAME3_MPI} DESTINATION bin)
else()
message("## Skipping 'integral 1/2/3 advanced': no MPI support found")
dummy_install(${NAME} "MPI")
# dummy_install(${NAME} "MPI")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
......
# Packages are optional: if they are not present, certain code samples are not compiled
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
find_package(OpenMP) # Built-in in CMake
find_package(MPI) # Built-in in CMake
......@@ -9,6 +11,10 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/common.cmake)
if ("${DWARF_PREFIX}" STREQUAL "")
set(DWARF_PREFIX 7_montecarlo)
endif()
set(NAME_OMP ${DWARF_PREFIX}_integral1d_omp)
set(NAME_SERIAL ${DWARF_PREFIX}_integral1d_serial)
set(NAME_MPI ${DWARF_PREFIX}_integral1d_mpi)
# C compiler settings
......@@ -16,25 +22,31 @@ find_package(Common)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
add_executable(integral1d_OMP integral1d_OMP.c)
target_link_libraries(integral1d_OMP m)
add_executable(${NAME_OMP} integral1d_OMP.c)
target_link_libraries(${NAME_OMP} m)
install(TARGETS ${NAME_OMP} DESTINATION bin)
else()
message("## Skipping 'integral1d_OMP': no OpenMP support found")
dummy_install(${NAME} "OpenMP")
# dummy_install(${NAME} "OpenMP")
endif()
if (MPI_FOUND)
cmake_policy(SET CMP0003 OLD)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
include_directories(${MPI_INCLUDE_PATH})
add_executable(integral1d_mpi integral1d_mpi.c)
target_link_libraries(integral1d_mpi m ${MPI_LIBRARIES})
add_executable(${NAME_MPI} integral1d_mpi.c)
target_link_libraries(${NAME_MPI} m ${MPI_LIBRARIES} stdc++)
install(TARGETS ${NAME_MPI} DESTINATION bin)
else()
message("## Skipping 'integral1d_mpi': no MPI support found")
dummy_install(${NAME} "MPI")
# dummy_install(${NAME} "MPI")
endif()
add_executable(integral1d integral1d.c)
target_link_libraries(integral1d m)
add_executable(${NAME_SERIAL} integral1d.c)
target_link_libraries(${NAME_SERIAL} m)
install(TARGETS ${NAME_SERIAL} DESTINATION bin)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
......
# Packages are optional: if they are not present, certain code samples are not compiled
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
find_package(OpenMP) # Built-in in CMake
find_package(MPI) # Built-in in CMake
......@@ -9,6 +11,10 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/common.cmake)
if ("${DWARF_PREFIX}" STREQUAL "")
set(DWARF_PREFIX 7_montecarlo)
endif()
set(NAME_OMP ${DWARF_PREFIX}_pi_omp)
set(NAME_SERIAL ${DWARF_PREFIX}_pi_serial)
set(NAME_MPI ${DWARF_PREFIX}_pi_mpi)
# C compiler settings
......@@ -16,21 +22,27 @@ find_package(Common)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
add_executable(pi_omp pi_omp.c pi_shared.c)
add_executable(${NAME_OMP} pi_omp.c pi_shared.c)
install(TARGETS ${NAME_OMP} DESTINATION bin)
else()
message("## Skipping 'pi_omp': no OpenMP support found")
dummy_install(${NAME} "OpenMP")
# dummy_install(${NAME} "OpenMP")
endif()
if (MPI_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
cmake_policy(SET CMP0003 OLD)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
include_directories(${MPI_INCLUDE_PATH})
add_executable(pi_mpi pi_mpi.c pi_shared.c)
target_link_libraries(pi_mpi ${MPI_LIBRARIES})
add_executable(${NAME_MPI} pi_mpi.c pi_shared.c)
target_link_libraries(${NAME_MPI} ${MPI_LIBRARIES} stdc++)
install(TARGETS ${NAME_MPI} DESTINATION bin)
endif()
add_executable(pi_serial pi_serial.c pi_shared.c)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
add_executable(${NAME_SERIAL} pi_serial.c pi_shared.c)
install(TARGETS ${NAME_SERIAL} DESTINATION bin)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
unset(NAME)
# ==================================================================================================
# Packages are optional: if they are not present, certain code samples are not compiled
cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR)
find_package(OpenMP) # Built-in in CMake
find_package(MPI) # Built-in in CMake
......@@ -10,32 +12,42 @@ if ("${DWARF_PREFIX}" STREQUAL "")
set(DWARF_PREFIX 7_montecarlo)
endif()
set(NAME_OMP ${DWARF_PREFIX}_prng_omp)
set(NAME_SERIAL ${DWARF_PREFIX}_prng_serial)
set(NAME_MPI ${DWARF_PREFIX}_prng_mpi)
# C compiler settings
find_package(Common)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
add_executable(random_openmp random_openmp.c)
target_link_libraries(random_openmp m)
add_executable(${NAME_OMP} random_openmp.c)
target_link_libraries(${NAME_OMP} m)
install(TARGETS ${NAME_OMP} DESTINATION bin)
else()
message("## Skipping 'random_openmp': no OpenMP support found")
dummy_install(${NAME} "OpenMP")
# dummy_install(${NAME_OMP} "OpenMP")
endif()
if (MPI_FOUND)
cmake_policy(SET CMP0003 OLD)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
include_directories(${MPI_INCLUDE_PATH})
add_executable(random_mpi random_mpi.c)
target_link_libraries(random_mpi m ${MPI_LIBRARIES})
add_executable(${NAME_MPI} random_mpi.c)
target_link_libraries(${NAME_MPI} m ${MPI_LIBRARIES} stdc++)
install(TARGETS ${NAME_MPI} DESTINATION bin)
else()
message("## Skipping 'random_mpi': no MPI support found")
dummy_install(${NAME} "MPI")
# dummy_install(${NAME_MPI} "MPI")
endif()
add_executable(random random.c)
target_link_libraries(random m)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
add_executable(${NAME_SERIAL} random.c)
target_link_libraries(${NAME_SERIAL} m)
install(TARGETS ${NAME_SERIAL} DESTINATION bin)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS}")
unset(NAME)
# ==================================================================================================
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment