Commit e622ba87 authored by Mccaskey, Alex's avatar Mccaskey, Alex

fixing cuda shared linking

Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent ac74df59
......@@ -14,7 +14,7 @@ set(CMAKE_SKIP_INSTALL_RPATH OFF)
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(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
project(exatn LANGUAGES CXX Fortran)
......
......@@ -854,13 +854,13 @@ if(NOT CUDA_VERSION VERSION_LESS "5.5")
endif()
if(CUDA_cudart_static_LIBRARY)
#if(CUDA_cudart_static_LIBRARY)
# If static cudart available, use it by default, but provide a user-visible option to disable it.
option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON)
else()
# option(CUDA_USE_STATIC_CUDA_RUNTIME "Use the static version of the CUDA runtime library if available" ON)
#else()
# If not available, silently disable the option.
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF CACHE INTERNAL "")
endif()
# set(CUDA_USE_STATIC_CUDA_RUNTIME OFF CACHE INTERNAL "")
#endif()
if(CUDA_USE_STATIC_CUDA_RUNTIME)
set(CUDA_CUDART_LIBRARY_VAR CUDA_cudart_static_LIBRARY)
......
......@@ -2,14 +2,13 @@ set(LIBRARY_NAME exatn-mpi-rpc)
file(GLOB SRC *.cpp)
usFunctionGetResourceSource(TARGET ${LIBRARY_NAME} OUT SRC)
usFunctionGenerateBundleInit(TARGET ${LIBRARY_NAME} OUT SRC)
usfunctiongetresourcesource(TARGET ${LIBRARY_NAME} OUT SRC)
usfunctiongeneratebundleinit(TARGET ${LIBRARY_NAME} OUT SRC)
add_library(${LIBRARY_NAME} SHARED ${SRC})
add_dependencies(${LIBRARY_NAME} exatensor-build)
if(CUDA_FOUND)
target_include_directories(${LIBRARY_NAME}
PUBLIC .
......@@ -19,6 +18,17 @@ if(CUDA_FOUND)
${MPI_CXX_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include
${CUDA_INCLUDE_DIRS})
target_link_libraries(
${LIBRARY_NAME}
PUBLIC exatn
exatn-numerics
exatn-utility
${MPI_CXX_LIBRARIES}
CppMicroServices
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so
${CUDA_LIBRARIES}
${CUDA_CUBLAS_LIBRARIES}
)
else()
target_include_directories(${LIBRARY_NAME}
......@@ -29,6 +39,15 @@ else()
${MPI_CXX_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include)
target_link_libraries(
${LIBRARY_NAME}
PUBLIC exatn
exatn-numerics
exatn-utility
${MPI_CXX_LIBRARIES}
CppMicroServices
${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so)
endif()
set(_bundle_name exatn_mpi_rpc)
......@@ -38,14 +57,13 @@ set_target_properties(${LIBRARY_NAME}
US_BUNDLE_NAME
${_bundle_name})
usFunctionEmbedResources(TARGET
usfunctionembedresources(TARGET
${LIBRARY_NAME}
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
FILES
manifest.json)
target_link_libraries(${LIBRARY_NAME} PUBLIC exatn exatn-numerics exatn-utility ${MPI_CXX_LIBRARIES} CppMicroServices)
exatn_enable_rpath(${LIBRARY_NAME})
if(EXATN_BUILD_TESTS)
......
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)
target_link_libraries(client_test PRIVATE exatn exatn-utility ${MPI_CXX_LIBRARIES})
target_link_libraries(client_test PUBLIC exatn exatn-utility ${MPI_CXX_LIBRARIES} ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so)
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 PRIVATE exatn exatn-utility ${MPI_CXX_LIBRARIES}) # blas gfortran gomp ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so)
target_link_libraries(server_test PUBLIC exatn exatn-utility ${MPI_CXX_LIBRARIES}) # blas gfortran gomp ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so)
add_test(NAME client_server_test COMMAND mpirun --allow-run-as-root -np 1 ./server_test : -np 1 ./client_test)
......
......@@ -9,7 +9,7 @@ const std::string src = R"src(entry: main
scope main group()
subspace(): s0=[0:127]
index(s0): a,b,c,d,i,j,k,l
H2(a,b,c,d) = method("Hamiltonian")
H2(a,b,c,d) = method("HamiltonianTest")
T2(a,b,c,d) = {1.0,0.0}
Z2(a,b,c,d) = {0.0,0.0}
Z2(a,b,c,d) += H2(i,j,k,l) * T2(c,d,i,j) * T2(a,b,k,l)
......@@ -50,7 +50,7 @@ TEST(client_test, checkSimple) {
EXPECT_EQ(3.3, std::imag(values[0]));
std::cout << "[client.cpp] value second time is " << std::real(values[0]) << ", " << std::imag(values[0]) << "\n";
// auto tm = exatn::getService<TensorMethod<exatn::Identifiable>>("example-tensor-method");
auto tm = exatn::getService<TensorMethod<exatn::Identifiable>>("HamiltonianTest");
// client->registerTensorMethod(*tm.get());
// Shutdown the client, this
......
......@@ -16,6 +16,8 @@ target_include_directories(
${LIBRARY_NAME}
PRIVATE ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/include ${CMAKE_SOURCE_DIR}/src/utility ${CUDA_INCLUDE_DIRS})
target_link_libraries(${LIBRARY_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/tpls/ExaTensor/lib/libtalsh.so)
set(_bundle_name exatn_example_tensormethod)
set_target_properties(${LIBRARY_NAME}
......@@ -33,5 +35,6 @@ usFunctionEmbedResources(TARGET
${CMAKE_CURRENT_SOURCE_DIR}
FILES
manifest.json)
exatn_enable_rpath(${LIBRARY_NAME})
install(TARGETS ${LIBRARY_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/plugins)
Markdown is supported
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