install_petsc.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # !!! THE GFORTRAN, GCC, AND G++ COMPILERS MUST BE AVAILABLE !!!
  3. #
  4. # THIS SCRIPT INSTALLS IN ~/SLlibs THE PETSC LIBRARY.
  5. ########## ALL LIBRARIES REQUIRED BY SPARSELIZARD ARE PUT IN ~/SLlibs.
  6. rm -rf ~/SLlibs/petsc;
  7. mkdir ~/SLlibs;
  8. cd ~/SLlibs;
  9. ########## DOWNLOAD PETSC :
  10. echo '__________________________________________';
  11. echo 'FETCHING THE LATEST PETSC VERSION FROM GIT';
  12. git clone -b maint https://gitlab.com/petsc/petsc.git petsc;
  13. ########## CONFIGURE PETSC (SELECT THE APPROPRIATE CONFIGURATION OPTIONS BELOW) :
  14. echo '__________________________________________';
  15. echo 'CONFIGURING PETSC';
  16. cd petsc;
  17. if [ "$(uname)" == "Linux" ]; then
  18. PETSC_DIR=$(pwd);
  19. PETSC_ARCH=arch-linux2-c-opt;
  20. elif [ "$(uname)" == "Darwin" ]; then
  21. PETSC_DIR=$(pwd);
  22. PETSC_ARCH=arch-darwin-c-opt;
  23. fi
  24. # The configuration below does not add support for additional mesh formats but does not require mpi.
  25. ./configure --with-openmp --with-mpi=0 --with-shared-libraries=1 --with-mumps-serial=1 --download-mumps --download-openblas --download-slepc --with-debugging=0 --with-scalar-type=real COPTFLAGS='-O3' CXXOPTFLAGS='-O3' FOPTFLAGS='-O3';
  26. # The configuration below adds support for .exo and .med mesh formats (mpi is needed and it is therefore added to the configuration options).
  27. # Support for cgns can be added by manually installing cgns then providing the cgns folder to petsc.
  28. #
  29. # ADDITIONAL STEPS TO PERFORM FOR THIS CONFIGURATION OF PETSC:
  30. # --> INSTALL CMAKE, AUTOTOOLS AND AUTOCONF BEFORE RUNNING THE CONFIGURE COMMAND BELOW (on Ubuntu type: sudo apt-get install cmake autotools-dev autoconf)
  31. # --> IN THE MAKEFILE REMOVE '-I ~/SLlibs/petsc/include/petsc/mpiuni' (otherwise the wrong mpi.h header is selected during make)
  32. #
  33. #./configure --with-openmp --download-mpich --download-mumps --download-scalapack --download-openblas --download-slepc --download-med --download-hdf5 --download-zlib --download-netcdf --download-pnetcdf --download-exodusii --with-scalar-type=real --with-debugging=0 COPTFLAGS='-O3' CXXOPTFLAGS='-O3' FOPTFLAGS='-O3';
  34. ########## COMPILE PETSC :
  35. echo '__________________________________________';
  36. echo 'COMPILING PETSC';
  37. make $PETSC_DIR $PETSC_ARCH all;
  38. make $PETSC_DIR $PETSC_ARCH test;
  39. cd ..;