Commit 87aaa1af authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

Updates to the build system to support building on mac os x



Signed-off-by: Mccaskey, Alex's avatarAlex Mccaskey <mccaskeyaj@ornl.gov>
parent 4be15b2c
......@@ -15,7 +15,7 @@ set(CMAKE_SKIP_RPATH OFF)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DPATH_MAX=4096 -Wno-attributes")
project(exatn LANGUAGES CXX Fortran)
......
......@@ -9,6 +9,11 @@ add_library(${LIBRARY_NAME} SHARED ${SRC})
add_dependencies(${LIBRARY_NAME} exatensor-build)
set(TALSH_LIB ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so)
if (APPLE)
set(TALSH_LIB ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.a)
endif()
if(CUDA_FOUND)
target_include_directories(${LIBRARY_NAME}
PUBLIC .
......@@ -24,7 +29,7 @@ if(CUDA_FOUND)
exatn-taprol-parser
${MPI_CXX_LIBRARIES}
CppMicroServices
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so
${TALSH_LIB}
${CUDA_LIBRARIES}
${CUDA_CUBLAS_LIBRARIES})
......@@ -44,7 +49,7 @@ else()
exatn-taprol-parser
${MPI_CXX_LIBRARIES}
CppMicroServices
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so)
${TALSH_LIB})
endif()
......
add_executable(client_test client.cpp)
target_include_directories(client_test PRIVATE ${CUDA_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include ${MPI_CXX_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/driver-rpc ${CMAKE_SOURCE_DIR}/src)
add_executable(server_test server.cpp)
if (CUDA_FOUND)
target_include_directories(client_test PRIVATE ${CUDA_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include ${MPI_CXX_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/driver-rpc ${CMAKE_SOURCE_DIR}/src)
target_include_directories(server_test PRIVATE ${CUDA_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include ${MPI_CXX_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/driver-rpc ${CMAKE_SOURCE_DIR}/src)
else()
target_include_directories(client_test PRIVATE ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include ${MPI_CXX_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/driver-rpc ${CMAKE_SOURCE_DIR}/src)
target_include_directories(server_test PRIVATE ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include ${MPI_CXX_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/driver-rpc ${CMAKE_SOURCE_DIR}/src)
endif()
target_link_libraries(client_test PUBLIC exatn ${MPI_CXX_LIBRARIES})
set_target_properties(client_test PROPERTIES FOLDER tests)
target_link_libraries(client_test PRIVATE gtest gmock gtest_main)
add_executable(server_test server.cpp)
target_include_directories(server_test PRIVATE ${CUDA_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include ${MPI_CXX_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/src/driver-rpc ${CMAKE_SOURCE_DIR}/src)
target_link_libraries(server_test PUBLIC exatn exatn-taprol-parser ${MPI_CXX_LIBRARIES})
add_test(NAME client_server_test COMMAND mpirun --allow-run-as-root -np 1 ./server_test : -np 1 ./client_test)
......@@ -14,4 +21,4 @@ add_test(NAME client_server_test COMMAND mpirun --allow-run-as-root -np 1 ./serv
add_dependencies(client_test exatensor-build)
add_dependencies(server_test exatensor-build)
add_subdirectory(example-tensor-method)
\ No newline at end of file
add_subdirectory(example-tensor-method)
......@@ -4,19 +4,61 @@ file(GLOB_RECURSE HEADERS *.hpp)
file(GLOB SRC *.cpp)
# Set up dependencies to resources to track changes
usFunctionGetResourceSource(TARGET ${LIBRARY_NAME} OUT SRC)
usfunctiongetresourcesource(TARGET
${LIBRARY_NAME}
OUT
SRC)
# Generate bundle initialization code
usFunctionGenerateBundleInit(TARGET ${LIBRARY_NAME} OUT SRC)
usfunctiongeneratebundleinit(TARGET
${LIBRARY_NAME}
OUT
SRC)
add_library(${LIBRARY_NAME} SHARED ${SRC})
add_dependencies(${LIBRARY_NAME} exatensor-build)
target_include_directories(
${LIBRARY_NAME}
PRIVATE ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include ${CMAKE_SOURCE_DIR}/src/exatn ${CUDA_INCLUDE_DIRS})
if(CUDA_FOUND)
target_include_directories(${LIBRARY_NAME}
PRIVATE ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include
${CMAKE_SOURCE_DIR}/src/exatn
${CUDA_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_TOOLKIT_ROOT_DIR}/lib64/libnvToolsExt.so ${BLAS_LIBRARIES} gfortran gomp CppMicroServices)
target_link_libraries(
${LIBRARY_NAME}
PUBLIC ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so
${CUDA_LIBRARIES}
${CUDA_CUBLAS_LIBRARIES}
${CUDA_TOOLKIT_ROOT_DIR}/lib64/libnvToolsExt.so
${BLAS_LIBRARIES}
gfortran
gomp
CppMicroServices)
else()
target_include_directories(${LIBRARY_NAME}
PRIVATE ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include
${CMAKE_SOURCE_DIR}/src/exatn)
if(APPLE)
message(STATUS "Linking TALSH to example tensor method")
target_link_libraries(
${LIBRARY_NAME}
PUBLIC ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.a
${BLAS_LIBRARIES}
gfortran
gomp
CppMicroServices)
else()
target_link_libraries(
${LIBRARY_NAME}
PUBLIC ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so
${BLAS_LIBRARIES}
gfortran
gomp
CppMicroServices)
endif()
endif()
set(_bundle_name exatn_example_tensormethod)
......@@ -29,12 +71,12 @@ set_target_properties(${LIBRARY_NAME}
US_BUNDLE_NAME ${_bundle_name})
# Embed meta-data from a manifest.json file
usFunctionEmbedResources(TARGET
usfunctionembedresources(TARGET
${LIBRARY_NAME}
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
FILES
manifest.json)
exatn_enable_rpath(${LIBRARY_NAME})
#exatn_enable_rpath(${LIBRARY_NAME})
install(TARGETS ${LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/plugins)
......@@ -34,4 +34,4 @@ public:
} // namespace
CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR(ExampleTensorMethodActivator)
\ No newline at end of file
CPPMICROSERVICES_EXPORT_BUNDLE_ACTIVATOR(ExampleTensorMethodActivator)
......@@ -12,7 +12,7 @@ add_library(${LIBRARY_NAME} SHARED ${SRC})
target_include_directories(
${LIBRARY_NAME}
PRIVATE ${CMAKE_SOURCE_DIR}/src/exatn)
target_link_libraries(${LIBRARY_NAME} PUBLIC CppMicroServices)
set(_bundle_name exatn_test_plugin)
set_target_properties(${LIBRARY_NAME}
......
exatn_add_test(NumericsTester NumericsTester.cpp)
target_include_directories(NumericsTester PRIVATE ${CMAKE_SOURCE_DIR}/src/numerics)
set(TALSH_LIB ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so)
if (APPLE)
set(TALSH_LIB ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.a)
endif()
if(CUDA_FOUND)
link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib64)
target_link_libraries(NumericsTester PRIVATE
exatn-numerics
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so
${TALSH_LIB}
${BLAS_LIBRARIES}
${CUDA_LIBRARIES}
${CUDA_CUBLAS_LIBRARIES}
......@@ -17,7 +22,7 @@ if(CUDA_FOUND)
else()
target_link_libraries(NumericsTester PRIVATE
exatn-numerics
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so
${TALSH_LIB}
${BLAS_LIBRARIES}
MPI::MPI_CXX
MPI::MPI_Fortran
......
......@@ -13,7 +13,11 @@ target_include_directories(${LIBRARY_NAME}
)
add_dependencies(${LIBRARY_NAME} antlr4_shared)
if (APPLE)
target_link_libraries(${LIBRARY_NAME} PUBLIC exatn exatn-numerics ${CMAKE_SOURCE_DIR}/dist/libantlr4-runtime.dylib)
else()
target_link_libraries(${LIBRARY_NAME} PUBLIC exatn exatn-numerics ${CMAKE_SOURCE_DIR}/dist/libantlr4-runtime.so)
endif()
if(APPLE)
set_target_properties(${LIBRARY_NAME} PROPERTIES INSTALL_RPATH "@loader_path")
......
......@@ -52,6 +52,17 @@ message(STATUS "MPI bin path: ${MPI_BIN_PATH}")
message(STATUS "MPI root path: ${MPI_ROOT_DIR}")
message(STATUS "CUDA Host Compiler: ${CMAKE_CXX_COMPILER}")
if (APPLE)
message(STATUS "THIS IS APPLE, BUILDING EXATENSOR ${CMAKE_Fortran_COMPILER}")
add_custom_target(
exatensor-build
COMMAND ${CMAKE_COMMAND} -E env CPP_GNU=${CMAKE_CXX_COMPILER} CC_GNU=${CMAKE_C_COMPILER} FC_GNU=${CMAKE_Fortran_COMPILER} MPILIB=MPICH BLASLIB=NONE
PATH_MPICH_INC=${MPI_ROOT_DIR}/include EXA_NO_BUILD=${TALSHXX_EXISTS}
PATH_MPICH_LIB=${MPI_ROOT_DIR}/lib
PATH_MPICH_BIN=${MPI_BIN_PATH} EXA_OS=NO_LINUX GPU_CUDA=NOCUDA EXA_TALSH_ONLY=YES make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ExaTensor)
else()
if(CUDA_FOUND)
message(STATUS "CUDA ROOT: ${CUDA_TOOLKIT_ROOT_DIR}")
message(STATUS "CUDA LIBRARIES: ${CUDA_LIBRARIES}")
......@@ -86,6 +97,7 @@ else()
PATH_OPENMPI_BIN=${MPI_BIN_PATH} make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ExaTensor)
endif()
endif()
# Compiler-specific C++11 activation (FROM ANTLR4).
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
......@@ -116,4 +128,4 @@ endif ()
set(BUILD_SHARED_LIBS FALSE)
set(BOOST_LIBS_OPTIONAL graph CACHE STRING "" FORCE)
add_subdirectory(boost-cmake)
\ No newline at end of file
add_subdirectory(boost-cmake)
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