IDAES / idaes-ext

IDAES developer repo for those building the idaes binary solvers and related tools.
Other
9 stars 11 forks source link

Check for Custom Build of Petsc in petsc.py #237

Open defencedog opened 1 year ago

defencedog commented 1 year ago

I have compiled my own petsc with multiple shared libraries on ARM64 Android. Because python3.9/site-packages/idaes/core/solvers/petsc.py doesn't have any check to discover custom locations of petsc I have to modify code slightly & used system environment variable ( in my case PETSC_DIR=$PREFIX/local ) to guide python to required location otherwise jupyter notebook gave error about PetscBinaryIOTrajectory.py not found

comment line 52 
# petsc_dir = os.path.join(icfg.bin_directory, "petscpy")
add x2 lines 
petsc_dir = os.environ["PETSC_DIR"]
petsc_dir = os.path.join(petsc_dir, "lib/petsc/bin/")

Because python wrappers were compiled AFTER compiling petsc itself this icfg.bin_directory cannot be used which refers to $HOME/.idaes/bin/ where only wrappers & some function libs are located