From e64f78418e2be47db7a50efc82d1859da40d6c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20Pep=C3=A8=20Sciarria?= Date: Thu, 3 Jul 2025 14:24:13 +0200 Subject: [PATCH] [ADD] CMake compilation for spmm test --- test/computational_routines/CMakeLists.txt | 57 +++++++++++++++++++ .../spmm/CMakeLists.txt | 8 +++ 2 files changed, 65 insertions(+) create mode 100644 test/computational_routines/CMakeLists.txt create mode 100644 test/computational_routines/spmm/CMakeLists.txt diff --git a/test/computational_routines/CMakeLists.txt b/test/computational_routines/CMakeLists.txt new file mode 100644 index 00000000..00731bc0 --- /dev/null +++ b/test/computational_routines/CMakeLists.txt @@ -0,0 +1,57 @@ +cmake_minimum_required(VERSION 3.10) +project(psblas_project Fortran) + +# Check for the installation path for psblas +if(NOT DEFINED PSBLAS_INSTALL_DIR) + message(FATAL_ERROR "Please specify the path to the psblas installation directory using -DPSBLAS_INSTALL_DIR=") +endif() + +# Set the include and library directories based on the provided path +set(INSTALLDIR "${PSBLAS_INSTALL_DIR}") +set(INCDIR "${INSTALLDIR}/include") +set(MODDIR "${INSTALLDIR}/modules") +set(LIBDIR "${INSTALLDIR}/lib") + +# Find the psblas package +find_package(psblas REQUIRED PATHS ${INSTALLDIR}) + +# for Fortran compiler +include_directories(${INCDIR} ${MODDIR}) + +# Define executable directory +set(EXEDIR "${CMAKE_CURRENT_SOURCE_DIR}/runs") + +# Ensure the executable directory exists +file(MAKE_DIRECTORY ${EXEDIR}) + +# PSBLAS libraries +set(PSBLAS_LIBS psblas::util psblas::prec psblas::base) + + +#include(${CMAKE_CURRENT_LIST_DIR}/geaxpby/CMakeLists.txt) +#include(${CMAKE_CURRENT_LIST_DIR}/gedor/CMakeLists.txt) +include(${CMAKE_CURRENT_LIST_DIR}/spmm/CMakeLists.txt) + +# Create executables +#add_executable(psb_geaxpby ${GEAXPBY_SOURCES}) +#add_executable(psb_gedot ${GEDOT_SOURCES}) +add_executable(psb_spmm_test ${spmm_source_files}) + +# Link the necessary libraries +#target_link_libraries(psb_geaxpby psblas::util psblas::prec psblas::base) +#target_link_libraries(psb_gedot psblas::util psblas::prec psblas::base) +target_link_libraries(psb_spmm_test ${PSBLAS_LIBS}) + +# Set output directory for the executables +#set_target_properties(psb_geaxpby PROPERTIES +# RUNTIME_OUTPUT_DIRECTORY ${EXEDIR} +#) +#set_target_properties(psb_gedot PROPERTIES +# RUNTIME_OUTPUT_DIRECTORY ${EXEDIR} +#) +set_target_properties(psb_spmm_test PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${EXEDIR} +) + +# Inform the user of successful configuration +message(STATUS "CMake configuration complete. Build with 'make' in the build directory.") diff --git a/test/computational_routines/spmm/CMakeLists.txt b/test/computational_routines/spmm/CMakeLists.txt new file mode 100644 index 00000000..0147bc76 --- /dev/null +++ b/test/computational_routines/spmm/CMakeLists.txt @@ -0,0 +1,8 @@ +set(PSB_spmm_source_files + psb_spmm_test.f90 + spmm.f90 +) +foreach(file IN LISTS PSB_spmm_source_files) + list(APPEND spmm_source_files ${CMAKE_CURRENT_LIST_DIR}/${file}) +endforeach() +