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

Fails to build with SuperLU option #3171

Closed
yurivict opened this issue Aug 25, 2022 · 15 comments
Closed

Fails to build with SuperLU option #3171

yurivict opened this issue Aug 25, 2022 · 15 comments
Assignees

Comments

@yurivict
Copy link

When configured with -DMFEM_USE_SUPERLU=ON -DSuperLUDist_DIR=/usr/local -DSuperLUDist_INCLUDE_DIRS=/usr/local/include/superlu the build fails:

/disk-samsung/freebsd-ports/math/mfem/work/mfem-4.4/linalg/superlu.cpp:20:10: fatal error: 'superlu_defs.h' file not found
#include "superlu_defs.h"
         ^~~~~~~~~~~~~~~~
1 error generated.

superlu-5.3.0 doesn't install superlu_defs.h.

Version: 4.4
clang-14
FreeBSD 13.1

@v-dobrev
Copy link
Member

The version of SuperLU_Dist (v5 vs v6 and newer) is not auto-detected: when using v5, please set the flag MFEM_USE_SUPERLU5 to ON.

@yurivict
Copy link
Author

Thanks!

@tzanio tzanio self-assigned this Aug 28, 2022
@yurivict
Copy link
Author

yurivict commented Sep 5, 2022

When superlu-dist is used - libmfem.so.4.4.0 isn't linked with its shared library:

/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `PStatInit'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `dLUstructInit'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `dSolveFinalize'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `superlu_free_dist'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `dCreate_CompRowLoc_Matrix_dist'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `pdgssvx'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `dScalePermstructFree'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `superlu_gridinit'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `Destroy_CompRowLoc_Matrix_dist'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `dDestroy_LU'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `superlu_abort_and_exit_dist'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `dLUstructFree'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `set_default_options_dist'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `superlu_gridexit'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `intMalloc_dist'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `PStatFree'
/usr/local/bin/ld: /usr/local/lib/libmfem.so.4.4.0: undefined reference to `doubleMalloc_dist'

@yurivict yurivict reopened this Sep 5, 2022
@stale
Copy link

stale bot commented Oct 8, 2022

⚠️ This issue or PR has been automatically marked as stale because it has not had any activity in the last month. If no activity occurs in the next week, it will be automatically closed. Thank you for your contributions.

@stale stale bot added the stale label Oct 8, 2022
@stale stale bot closed this as completed Oct 15, 2022
@v-dobrev
Copy link
Member

Hi @yurivict, sorry for the late reply.

I was not able to reproduce the issue. In the CMake output, what does the line containing Found SuperLUDist: look like in your case?

@v-dobrev v-dobrev reopened this Oct 17, 2022
@stale stale bot removed stale labels Oct 17, 2022
@tzanio
Copy link
Member

tzanio commented Nov 1, 2022

Hi @yurivict, is this still an issue after the 4.5 release.

@yurivict
Copy link
Author

yurivict commented Nov 1, 2022

4.5 doesn't have this problem.

@yurivict
Copy link
Author

yurivict commented Nov 1, 2022

Sorry, I take it back.
Without -L${LOCALBASE}/lib -lsuperlu_dist it builds but the library has missing symbols:

ld: error: libmfem.so.4.5.0: undefined reference to intMalloc_dist [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to superlu_abort_and_exit_dist [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to dLUstructInit [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to pdgssvx [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to doubleMalloc_dist [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to dCreate_CompRowLoc_Matrix_dist [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to Destroy_CompRowLoc_Matrix_dist [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to set_default_options_dist [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to PStatInit [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to superlu_free_dist [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to PStatFree [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to dScalePermstructFree [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to dDestroy_LU [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to dLUstructFree [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to dSolveFinalize [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to superlu_gridinit [--no-allow-shlib-undefined]
ld: error: libmfem.so.4.5.0: undefined reference to superlu_gridexit [--no-allow-shlib-undefined]

@v-dobrev
Copy link
Member

v-dobrev commented Nov 1, 2022

In the CMake output, what does the line containing Found SuperLUDist: look like in your case?

@yurivict
Copy link
Author

yurivict commented Nov 1, 2022

It only says:
-- MFEM: using package SuperLUDist

When MFEM_USE_SUPERLU=ON it uses find_package:

find_package(SuperLUDist REQUIRED)

However, superlu-dist-8.1.1 doesn't install cmake scripts. We have to supply -DSuperLUDist_DIR=${LOCALBASE} -DSuperLUDist_INCLUDE_DIRS=${LOCALBASE}/include/superlu to assist cmake. Then libraries also need to be supplied.

Instead you should use pkg-config (through cmake) to find superlu-dist:

$ pkg-config --cflags --libs superlu_dist
-I/usr/local/include -L/usr/local/lib -lsuperlu_dist 

@stale
Copy link

stale bot commented Dec 3, 2022

⚠️ This issue or PR has been automatically marked as stale because it has not had any activity in the last month. If no activity occurs in the next week, it will be automatically closed. Thank you for your contributions.

@stale stale bot added the stale label Dec 3, 2022
@yurivict
Copy link
Author

yurivict commented Dec 3, 2022

not stale

@stale stale bot removed the stale label Dec 3, 2022
@v-dobrev
Copy link
Member

v-dobrev commented Dec 5, 2022

One thing that seems wrong is the flag you specify:

-DSuperLUDist_INCLUDE_DIRS=${LOCALBASE}/include/superlu

and that directory is not the directory that pkg-config shows in the snippet you posted above. Maybe you just need to use

-DSuperLUDist_INCLUDE_DIRS=${LOCALBASE}/include

You can also set just SuperLUDist_DIR (without setting SuperLUDist_INCLUDE_DIRS and SuperLUDist_LIBRARIES) and let MFEM's CMake build system try to find the right SuperLUDist_INCLUDE_DIRS and SuperLUDist_LIBRARIES, in other words just set the following SuperLU_Dist-related flags:

-DMFEM_USE_SUPERLU=ON -DSuperLUDist_DIR=${LOCALBASE}

If MFEM's CMake build system does not work with these settings, only then you'll need to set SuperLUDist_INCLUDE_DIRS and SuperLUDist_LIBRARIES manually (and there's no need to set SuperLUDist_DIR in this case):

-DMFEM_USE_SUPERLU=ON \
-DSuperLUDist_INCLUDE_DIRS=${LOCALBASE}/include \
-DSuperLUDist_LIBRARIES="-L${LOCALBASE}/lib -lsuperlu_dist"

Regarding the link failures: if you are setting SuperLUDist_INCLUDE_DIRS you should also set SuperLUDist_LIBRARIES.

Both other issues #3191 and #3276 seem to be revolving around the same or similar issues with SuperLU_DIST. It is best to keep the discussion in one place -- it seems to me the root of all these issues is the same.

@stale
Copy link

stale bot commented Jan 7, 2023

⚠️ This issue or PR has been automatically marked as stale because it has not had any activity in the last month. If no activity occurs in the next week, it will be automatically closed. Thank you for your contributions.

@stale stale bot added the stale label Jan 7, 2023
@stale stale bot closed this as completed Jan 16, 2023
@tzanio tzanio changed the title Fails to build with SuperLu option Fails to build with SuperLU option Oct 17, 2023
@jandrej
Copy link
Member

jandrej commented Oct 18, 2023

confirming that the version 4.4 works on FreeBSD 13.2 with ports from 10/17/2023. @yurivict let us know if you need help upgrading to mfem 4.6.

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

No branches or pull requests

4 participants