Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to compile with parmetis? #75

Closed
miaodi opened this issue Mar 3, 2024 · 1 comment · Fixed by #82
Closed

How to compile with parmetis? #75

miaodi opened this issue Mar 3, 2024 · 1 comment · Fixed by #82

Comments

@miaodi
Copy link

miaodi commented Mar 3, 2024

I tried to compile mumps with parmetis. I have installed parmetis to a folder ($PARMETIS_ROOT) and tried to configure the cmake project with: cmake .. -Dparmetis=1 -Dparallel=1 -DMETIS_LIBRARY=${PARMETIS_ROOT}/libparmetis.so -DMETIS_INCLUDE_DIR=${PARMETIS_ROOT}/include

and i got the following error:

CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find METIS (missing: parallel)
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
cmake/FindMETIS.cmake:59 (find_package_handle_standard_args)
CMakeLists.txt:85 (find_package)

@miaodi
Copy link
Author

miaodi commented Mar 3, 2024

My parmetis version is 4.0.3. It seems that when parmetis is enable, mumps needs both metis and parmetis to finish the compilation.

I modified FindMETIS.cmake:

if("parallel" IN_LIST METIS_FIND_COMPONENTS)
  find_library(PARMETIS_LIBRARY
    NAMES parmetis
    PATH_SUFFIXES METIS libmetis
    DOC "ParMETIS library"
    )
  if(PARMETIS_LIBRARY)
    set(METIS_parallel_FOUND true)

    find_path(PARMETIS_INCLUDE_DIR
    NAMES parmetis.h
    PATH_SUFFIXES METIS openmpi-x86_64 mpich-x86_64 
    DOC "METIS include directory"
    )
  endif()
endif()

find_library(METIS_LIBRARY
  NAMES metis
  PATH_SUFFIXES METIS libmetis
  DOC "METIS library"
  )

find_path(METIS_INCLUDE_DIR
NAMES metis.h
PATH_SUFFIXES METIS openmpi-x86_64 mpich-x86_64
DOC "METIS include directory"
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(METIS
REQUIRED_VARS METIS_LIBRARY METIS_INCLUDE_DIR
HANDLE_COMPONENTS
)

if(METIS_FOUND)

set(METIS_LIBRARIES ${PARMETIS_LIBRARY} ${METIS_LIBRARY})
set(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR} ${PARMETIS_INCLUDE_DIR})

message(VERBOSE "METIS libraries: ${METIS_LIBRARIES}
METIS include directories: ${METIS_INCLUDE_DIRS}")

if(NOT TARGET METIS::METIS)
  add_library(METIS::METIS INTERFACE IMPORTED)
  set_property(TARGET METIS::METIS PROPERTY INTERFACE_LINK_LIBRARIES "${METIS_LIBRARIES}")
  set_property(TARGET METIS::METIS PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${METIS_INCLUDE_DIRS}")
endif()
endif(METIS_FOUND)

mark_as_advanced(METIS_INCLUDE_DIR METIS_LIBRARY PARMETIS_LIBRARY)

and now it can compile mumps with parmetis (cmake .. -Dparmetis=1 -Dparallel=1 -DMETIS_ROOT=/home/dimiao/installed/metis -DPARMETIS_LIBRARY=/home/dimiao/installed/parmetis/lib/libparmetis.so -DPARMETIS_INCLUDE_DIR=/home/dimiao/installed/parmetis/include/).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant