openfoam-os-x icon indicating copy to clipboard operation
openfoam-os-x copied to clipboard

OpenFOAMv2306 and scotch library linking

Open aqeelahmed168 opened this issue 1 year ago • 14 comments

Hi,

I tried to compile the OpenFOAM v2306 as the normal process suggested here (https://github.com/mrklein/openfoam-os-x/wiki/OpenFOAM(R)-release-&-Homebrew), without applying any patch.

However, when running decomposePar I get this message:

--> FOAM FATAL ERROR: (openfoam-2306)
Attempted to use <scotch> without the scotchDecomp library loaded.
This message is from the dummy scotchDecomp stub library instead.

Please install <scotch> and ensure libscotch.so is in LD_LIBRARY_PATH.
The scotchDecomp library can then be built from src/parallel/decompose/scotchDecomp.
Dynamically loading or linking this library will add <scotch> as a decomposition method.

Similar process was followed with v10 (with patch) and that has correct linking for this library.

Do you have any suggestion to manually link the libraries (without building new scotch lib)?

aqeelahmed168 avatar Jul 26 '23 20:07 aqeelahmed168

I looks very like empty DYLD_LIBRARY_PATH problem, still I will try to reproduce the error.

Do you have any personal configuration for third party libraries (ex. $HOME/.OpenFOAM/config.sh/scotch file which sets SCOTCH_ARCH_PATH variable)?

mrklein avatar Jul 27 '23 12:07 mrklein

No, I do not have any specific configuration.

aqeelahmed168 avatar Jul 27 '23 12:07 aqeelahmed168

Foundation's OpenFOAM and ESI's OpenFOAM have different way of searching for third party libraries. Guess, if you look through the compilation log, you find these lines:

==> skip scotch (no header)
==> skip scotch (no header)

As you said, you do not have any special configuration for scotch, then, guess, your SCOTCH_ARCH_PATH is set to missing third party folder. have_scotch cannot find the header and simply disables this component.

Simple solution would be to create $HOME/.OpenFOAM/config.sh/scotch file with one line:

SCOTCH_VERSION=scotch-system

Setup OpenFOAM environment and run Allwmake script in $FOAM_SRC/parallel/decompose folder.

Maybe it could be proposed as a feature request in ESI's repository to modify have_scotch logic by adding system-wide search as a fall-back even if SCOTCH_VERSION is not scotch-system.

mrklein avatar Jul 28 '23 08:07 mrklein

Thanks a lot, issue resolved.

Would be nice to have it as a standard feature though.

aqeelahmed168 avatar Jul 28 '23 10:07 aqeelahmed168

Thanks a lot, issue resolved.

Would be nice to have it as a standard feature though.

hi, can you give me some information how to fix this problem?

I have the same problem!

Thank you very much!

wo315 avatar Dec 07 '23 14:12 wo315

Hi,

Could you elaborate? What did not work for you in the message https://github.com/mrklein/openfoam-os-x/issues/87#issuecomment-1655253065?

mrklein avatar Dec 08 '23 22:12 mrklein

Hi,

Could you elaborate? What did not work for you in the message #87 (comment)?

Thank you very much!

I compile the ESI version, OpenFOAM v2306.


  1. Modify the etc/bashrc like this

export WM_COMPILER_TYPE=system export WM_COMPILER=Gcc export WM_PRECISION_OPTION=DP export WM_LABEL_SIZE=32 export WM_COMPILE_OPTION=Debug export WM_MPLIB=SYSTEMOPENMPI

  1. and then modify etc/config.sh/scotch

SCOTCH_VERSION=scotch-none export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION

  1. compile ./Allwmake -j there also

==> skip scotch (no header) ==> skip scotch (no header)


So, I don't know how to fix this problem!

Can you give me some advices or tips ?

Thank you very much

Yang Wang

wo315 avatar Dec 09 '23 13:12 wo315

Editing this comment to add more useful information. After speaking to a colleague who is an OpenFOAM master and also a Mac user I've managed to get scotch to link.

$ brew install scotch

$ brew info scotch

brew info scotch
==> scotch: stable 7.0.4 (bottled), HEAD
Package for graph partitioning, graph clustering, and sparse matrix ordering
https://gitlab.inria.fr/scotch/scotch
/opt/homebrew/Cellar/scotch/7.0.4 (227 files, 11.3MB) *
  Poured from bottle using the formulae.brew.sh API on 2023-12-15 at 15:32:38
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/s/scotch.rb
License: CECILL-C
==> Dependencies
Build: bison ✘
Required: open-mpi ✔
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 62 (30 days), 169 (90 days), 435 (365 days)
install-on-request: 60 (30 days), 167 (90 days), 432 (365 days)
build-error: 0 (30 days)

Note that scotch is located here: /opt/homebrew/Cellar/scotch/7.0.4

After you've extracted or cloned OpenFOAM edit etc/config.sh/scotch to include:

export SCOTCH_VERSION=scotch-system
export SCOTCH_ARCH_PATH=/opt/homebrew/Cellar/scotch/7.0.4

then you can build OpenFOAM

nolankucd avatar Dec 14 '23 12:12 nolankucd

@wo315

  1. and then modify etc/config.sh/scotch

SCOTCH_VERSION=scotch-none export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$SCOTCH_VERSION

You set SCOTCH_VERSION to scotch-none, so compilation is skipped. You should set it to scotch-system to use system-wide installed Scotch.

Maybe also you should use brew's Scotch instead of custom formula. I made it when Scotch was removed from formulas.

mrklein avatar Dec 20 '23 15:12 mrklein

Thanks @mrklein for this excellent resource.

As a by the way (broadly related to this issue), OpenFOAM.com versions (e.g. v2312) no longer need patches for macOS; however, your guide is still useful regarding installing dependencies with Homebrew and creating a case-sensitive disk image. It might be useful to add a comment on this in the wiki; failing that, at least this thread will help those who search for it.

philipcardiff avatar Jan 11 '24 11:01 philipcardiff

@philipcardiff Thank you for the comment. So, the solution would be to remove mention of custom tap and to change formula name to simple scotch (guess, we can remove parmgridgen, do not know if anyone uses it)?

mrklein avatar Jan 23 '24 09:01 mrklein

@philipcardiff Thank you for the comment. So, the solution would be to remove mention of custom tap and to change formula name to simple scotch (guess, we can remove parmgridgen, do not know if anyone uses it)?

@nolankucd 's solution works for me: (i) brew install scotch; (ii) edit etc/config.sh/scotch and set SCOTCH_VERSION and SCOTCH_ARCH_PATH appropriately.

philipcardiff avatar Jan 23 '24 12:01 philipcardiff

Updated wiki. Do you think it OK now?

mrklein avatar Feb 09 '24 20:02 mrklein

Updated wiki. Do you think it OK now?

This looks good to me.

philipcardiff avatar Feb 12 '24 10:02 philipcardiff