mrklein / openfoam-os-x

Patches for OpenFOAM(R) to build it on OS X
93 stars 33 forks source link

OpenFOAMv2306 and scotch library linking #87

Open aqeelahmed168 opened 1 year ago

aqeelahmed168 commented 1 year ago

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)?

mrklein commented 1 year ago

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)?

aqeelahmed168 commented 1 year ago

No, I do not have any specific configuration.

mrklein commented 1 year ago

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.

aqeelahmed168 commented 1 year ago

Thanks a lot, issue resolved.

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

wo315 commented 10 months ago

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!

mrklein commented 10 months ago

Hi,

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

wo315 commented 10 months ago

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

nolankucd commented 10 months ago

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

mrklein commented 10 months ago

@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.

philipcardiff commented 9 months ago

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.

mrklein commented 9 months ago

@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)?

philipcardiff commented 9 months ago

@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.

mrklein commented 8 months ago

Updated wiki. Do you think it OK now?

philipcardiff commented 8 months ago

Updated wiki. Do you think it OK now?

This looks good to me.