diff --git a/.github/workflows/common-workflow.yml b/.github/workflows/common-workflow.yml index 01d7d56f7..3ac9f50c2 100644 --- a/.github/workflows/common-workflow.yml +++ b/.github/workflows/common-workflow.yml @@ -12,7 +12,7 @@ on: build_command: required: true type: string - ext_install_command: + ext_pkg_build_command: required: true type: string test_cases: @@ -39,46 +39,20 @@ jobs: test_matrix: ${{ steps.createTestMatrix.outputs.test_output }} steps: - name: Free disk space - run: | - # Source: https://dev.to/mathio/squeezing-disk-space-from-github-actions-runners-an-engineers-guide-3pjg#6-how-to-automate-cleanup-in-your-ci - # - - # Remove Java (JDKs) - #sudo rm -rf /usr/lib/jvm - - # Remove .NET SDKs - sudo rm -rf /usr/share/dotnet - - # Remove Swift toolchain - sudo rm -rf /usr/share/swift - - # Remove Haskell (GHC) - sudo rm -rf /usr/local/.ghcup - - # Remove Julia - sudo rm -rf /usr/local/julia* - - # Remove Android SDKs - sudo rm -rf /usr/local/lib/android - - # Remove Chromium (optional if not using for browser tests) - sudo rm -rf /usr/local/share/chromium - - # Remove Microsoft/Edge and Google Chrome builds - sudo rm -rf /opt/microsoft /opt/google - - # Remove Azure CLI - sudo rm -rf /opt/az - - # Remove PowerShell - sudo rm -rf /usr/local/share/powershell - - # Remove CodeQL and other toolcaches - sudo rm -rf /opt/hostedtoolcache - - docker system prune -af || true - docker builder prune -af || true - df -h + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: false + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true - name: Check out copy of repository uses: actions/checkout@v4 @@ -96,7 +70,7 @@ jobs: - name: Prepare external packages if: ${{ steps.cache-externalpackages.outputs.cache-hit != 'true' }} run: | - ${{ inputs.ext_install_command }} + ${{ inputs.ext_pkg_build_command }} - name: Get MATLAB if: ${{ inputs.interface == 'matlab' }} @@ -138,7 +112,12 @@ jobs: run: make -j4 install - name: Compress ISSM artifact - run: tar --exclude='./externalpackages/petsc/src' -cvf ISSM_artifact-${{ runner.os }}-${{ inputs.build_type }}.tar -C ${{ env.ISSM_DIR }}/ . + run: | + rm -rf .git + find externalpackages -maxdepth 1 -name src -exec rm -rf {} \; + find externalpackages -maxdepth 1 -name *tar.gz -exec rm -rf {} \; + find externalpackages -maxdepth 1 -name *zip -exec rm -rf {} \; + tar --exclude='./externalpackages/petsc/src' -cvf ISSM_artifact-${{ runner.os }}-${{ inputs.build_type }}.tar -C ${{ env.ISSM_DIR }}/ . - name: Upload ISSM artifact uses: actions/upload-artifact@v4 @@ -166,6 +145,7 @@ jobs: - name: Unpack ISSM artifact run: | tar -xvf ISSM_artifact-${{ runner.os }}-${{ inputs.build_type }}.tar + rm -rf ISSM_artifact-${{ runner.os }}-${{ inputs.build_type }}.tar source $ISSM_DIR/etc/environment.sh working-directory: ${{ env.ISSM_DIR }} shell: 'bash' @@ -175,7 +155,7 @@ jobs: id: setup-matlab uses: matlab-actions/setup-matlab@v2 with: - release: R2023b + release: R2025b cache: true - name: Creating matlab_ci.m diff --git a/.github/workflows/ubuntu-basic.yml b/.github/workflows/ubuntu-basic.yml index 35d766f3b..831e3bbaf 100644 --- a/.github/workflows/ubuntu-basic.yml +++ b/.github/workflows/ubuntu-basic.yml @@ -57,7 +57,7 @@ jobs: --with-triangle-dir="${ISSM_DIR}/externalpackages/triangle/install" \ --with-semic-dir="${ISSM_DIR}/externalpackages/semic/install" \ --with-m1qn3-dir="${ISSM_DIR}/externalpackages/m1qn3/install" - ext_install_command: | + ext_pkg_build_command: | cd $ISSM_DIR/externalpackages/triangle && ./install-linux.sh cd $ISSM_DIR/externalpackages/m1qn3 && ./install-linux.sh cd $ISSM_DIR/externalpackages/petsc && ./install-3.22-linux.sh diff --git a/.github/workflows/ubuntu-codipack.yml b/.github/workflows/ubuntu-codipack.yml index ddf0c5bde..0a1fdae22 100644 --- a/.github/workflows/ubuntu-codipack.yml +++ b/.github/workflows/ubuntu-codipack.yml @@ -62,7 +62,7 @@ jobs: --with-m1qn3-dir="${ISSM_DIR}/externalpackages/m1qn3/install" \ --with-medipack-dir="${ISSM_DIR}/externalpackages/medipack/install" \ --with-codipack-dir="${ISSM_DIR}/externalpackages/codipack/install" - ext_install_command: | + ext_pkg_build_command: | cd $ISSM_DIR/externalpackages/triangle && ./install-linux.sh cd $ISSM_DIR/externalpackages/m1qn3 && ./install-linux.sh cd $ISSM_DIR/externalpackages/petsc && ./install-3.22-linux.sh diff --git a/.github/workflows/ubuntu-python.yml b/.github/workflows/ubuntu-python.yml index c48432f50..e68758489 100644 --- a/.github/workflows/ubuntu-python.yml +++ b/.github/workflows/ubuntu-python.yml @@ -61,7 +61,7 @@ jobs: --with-triangle-dir="${ISSM_DIR}/externalpackages/triangle/install" \ --with-semic-dir="${ISSM_DIR}/externalpackages/semic/install" \ --with-m1qn3-dir="${ISSM_DIR}/externalpackages/m1qn3/install" - ext_install_command: | + ext_pkg_build_command: | cd $ISSM_DIR/externalpackages/triangle && ./install-linux.sh cd $ISSM_DIR/externalpackages/m1qn3 && ./install-linux.sh cd $ISSM_DIR/externalpackages/petsc && ./install-3.22-linux.sh diff --git a/.gitignore b/.gitignore index 8bd55b02a..7f7b47c91 100644 --- a/.gitignore +++ b/.gitignore @@ -95,3 +95,4 @@ examples/Data/*.mat examples/Data/*.txt examples/Data/*.zip examples/Data/Jakobshavn_2008_2011_Composite +examples/Helheim/Models diff --git a/README.md b/README.md index 17c44d93a..19bd75554 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,12 @@ ISSM is a large-scale thermo-mechanical 2D/3D parallelized multi-purpose finite-element software dedicated to ice sheet and sea-level modeling. ## Documentation -Just The Docs +A complete documentation is available here. ## Contact - Bug Reporting: Please direct compile and run time bug reports strictly related to ISSM's core code or API's to the 'Issues' page. - Questions: Please direct all other questions (e.g. model setup, configuration/compiling on a particular platform, compute cluster configuration) to the 'Discussions' page. + - Slack Workspace - Website: https://issm.jpl.nasa.gov (will be decommissioned soon) ## Checking Out a Copy of the Repository diff --git a/configure.ac b/configure.ac index bc93f0838..e077f5f84 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,8 @@ #Initializing configure -AC_INIT([Ice-sheet and Sea-level System Model (ISSM)],[4.24],[https://github.com/ISSMteam/ISSM/],[issm],[https://issmteam.github.io/ISSM-Documentation/]) -AC_CONFIG_AUX_DIR([./aux-config]) # Put config files in aux-config -AC_CONFIG_MACRO_DIR([m4]) # m4 macros are located in m4 +AC_INIT([Ice-sheet and Sea-level System Model (ISSM)],[2026.1],[https://github.com/ISSMteam/ISSM/],[issm],[https://issmteam.github.io/ISSM-Documentation/]) +AC_CONFIG_AUX_DIR([./aux-config]) # Put config files in aux-config +AC_CONFIG_MACRO_DIR([m4]) # m4 macros are located in m4 m4_include([m4/issm_options.m4]) #print header diff --git a/etc/environment.csh b/etc/environment.csh index 5b56b3818..f8998037c 100644 --- a/etc/environment.csh +++ b/etc/environment.csh @@ -98,11 +98,6 @@ if ( -d {$PETSC_ROOT} ) then endif endif -set SCOTCH_ROOT="{$ISSM_EXT_DIR}/scotch/install" -if ( -d {$SCOTCH_ROOT} ) then - setenv LD_LIBRARY_PATH {$LD_LIBRARY_PATH}:{$SCOTCH_ROOT}/lib -endif - set DAKOTA_ROOT="{$ISSM_EXT_DIR}/dakota/install" if ( -d {$DAKOTA_ROOT} ) then setenv PATH {$PATH}:{$DAKOTA_ROOT}/bin @@ -202,11 +197,6 @@ if ( -d {$TRIANGLE_ROOT} ) then setenv DYLD_LIBRARY_PATH {$DYLD_LIBRARY_PATH}:{$TRIANGLE_ROOT}/lib endif -set YAMS_ROOT="{$ISSM_EXT_DIR}/yams/install" -if ( -d {$YAMS_ROOT} ) then - setenv PATH {$PATH}:{$YAMS_ROOT} -endif - set VALGRIND_ROOT="{$ISSM_EXT_DIR}/valgrind/install" if ( -d {$VALGRIND_ROOT} ) then setenv PATH {$VALGRIND_ROOT}/bin:{$PATH} diff --git a/etc/environment.sh b/etc/environment.sh index 08f934019..c1cebc22d 100755 --- a/etc/environment.sh +++ b/etc/environment.sh @@ -339,9 +339,6 @@ if [ -d "${ADJOINTPETSC_TEMP}" ]; then ld_library_path_append "${ADJOINTPETSC_TEMP}/lib" fi -SCOTCH_ROOT_TEMP="${ISSM_EXT_DIR}/scotch/install" -ld_library_path_append "${SCOTCH_ROOT_TEMP}/lib" - BOOST_ROOT_TEMP="${ISSM_EXT_DIR}/boost/install" if [ -d "${BOOST_ROOT_TEMP}" ]; then export BOOST_ROOT=${BOOST_ROOT_TEMP} # Used in installation of Dakota @@ -445,16 +442,6 @@ if [ -d "${TRIANGLE_ROOT_TEMP}" ]; then fi fi -BBFTP_ROOT_TEMP="${ISSM_EXT_DIR}/bbftp/install" -if [ -d "${BBFTP_ROOT_TEMP}" ]; then - path_append "${BBFTP_ROOT_TEMP}/bin" -fi - -SHAPELIB_ROOT_TEMP="${ISSM_EXT_DIR}/shapelib/install" -if [ -d "${SHAPELIB_ROOT_TEMP}" ]; then - path_append "${SHAPELIB_ROOT_TEMP}/exec" -fi - ESMF_ROOT_TEMP="${ISSM_EXT_DIR}/esmf/install" if [ -d "${ESMF_ROOT_TEMP}" ]; then path_prepend "${ESMF_ROOT_TEMP}/bin" @@ -466,11 +453,6 @@ if [ -d "${NEOPZ_ROOT_TEMP}" ]; then export REFPATTERNDIR="${NEOPZ_ROOT_TEMP}/include/refpatterns" fi -YAMS_ROOT_TEMP="${ISSM_EXT_DIR}/yams/install" -if [ -d "${YAMS_ROOT_TEMP}" ]; then - path_prepend "${YAMS_ROOT_TEMP}" -fi - VALGRIND_ROOT_TEMP="${ISSM_DIR}/externalpackages/valgrind/install" if [ -d "${VALGRIND_ROOT_TEMP}" ]; then path_prepend "${VALGRIND_ROOT_TEMP}/bin" diff --git a/externalpackages/adjointpetsc/install-andes.sh b/externalpackages/adjointpetsc/install-andes.sh new file mode 100755 index 000000000..013cb50bc --- /dev/null +++ b/externalpackages/adjointpetsc/install-andes.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -eu + +#Some cleanup +rm -rf install src build + +#Download development version +git clone https://github.com/SciCompKL/adjoint-PETSc.git src +mkdir install +mkdir build + +grep -rl 'remove_cvref_t' . | xargs sed -i 's/std::remove_cvref_t<\([A-Za-z0-9_]*\)>/std::remove_cv_t>/g' + +$ISSM_DIR/externalpackages/cmake/install/bin/cmake src \ + -B build \ + -DBUILD_TESTING=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DCMAKE_BUILD_TYPE=RELEASE \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_INSTALL_PREFIX=$ISSM_DIR/externalpackages/adjointpetsc/install \ + -DCoDiPack_DIR=$ISSM_DIR/externalpackages/codipack/install/cmake \ + -DPETSc_DIR=$ISSM_DIR/externalpackages/petsc/install + +if [ $# -eq 0 ]; then + cmake --build build +else + cmake --build build -j $1 +fi +cmake --install build diff --git a/externalpackages/bbftp/install.sh b/externalpackages/bbftp/install.sh deleted file mode 100755 index bb1e0e4b7..000000000 --- a/externalpackages/bbftp/install.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -set -eu - -#Some cleanup -rm -rf src install bbftp-client-3.2.0 - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/bbftp-client-3.2.0.tar.gz' 'bbftp-client-3.2.0.tar.gz' - -#Create install directories -mkdir install src - -#Untar -tar -zxvf bbftp-client-3.2.0.tar.gz - -#Move bbftp-client into install directory -mv bbftp-client-3.2.0/* src -rm -rf bbftp-client-3.2.0 - -#Apply patches -cd src - -#Configure and compile -cd bbftpc -./configure --prefix=$ISSM_DIR/externalpackages/bbftp/install -make -make install diff --git a/externalpackages/cppcheck/install-dev.sh b/externalpackages/cppcheck/install-dev.sh deleted file mode 100755 index 0003c7272..000000000 --- a/externalpackages/cppcheck/install-dev.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -eu - -#Erase install -rm -rf install src -mkdir install - -#Download -git clone git@github.com:danmar/cppcheck.git src - -#compile -cd src -if [ $# -eq 0 ]; then - make MATCHCOMPILER=yes FILESDIR=$ISSM_DIR/externalpackages/cppcheck/install HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" -else - make -j $1 MATCHCOMPILER=yes FILESDIR="$ISSM_DIR/externalpackages/cppcheck/install" HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" -fi -cd .. diff --git a/externalpackages/cppcheck/install.sh b/externalpackages/cppcheck/install.sh index 1d919ca29..5f9502971 100755 --- a/externalpackages/cppcheck/install.sh +++ b/externalpackages/cppcheck/install.sh @@ -1,23 +1,21 @@ #!/bin/bash set -eu -#Erase install -rm -rf install src cppcheck-1.48 -mkdir src -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/cppcheck-1.48.tar' 'cppcheck-1.48.tar' -tar -xvf cppcheck-1.48.tar +## Constants +# +PREFIX="${ISSM_DIR}/externalpackages/cppcheck/install" # Set to location where external package should be installed -mv cppcheck-1.48/* src -rm -rf cppcheck-1.48 +# Cleanup +rm -rf ${PREFIX} src -#compile +# Download source +git clone git@github.com:danmar/cppcheck.git src + +# Compile and install cd src if [ $# -eq 0 ]; then - make -else - make -j $1 -fi -make install PREFIX=$ISSM_DIR/externalpackages/cppcheck/install -cd .. + make MATCHCOMPILER=yes FILESDIR="${PREFIX}" HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" +else + make -j $1 MATCHCOMPILER=yes FILESDIR="${PREFIX}" HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function" +fi diff --git a/externalpackages/esmf/install.sh b/externalpackages/esmf/install.sh index eec5d256f..778509d80 100755 --- a/externalpackages/esmf/install.sh +++ b/externalpackages/esmf/install.sh @@ -1,21 +1,30 @@ #!/bin/bash set -eu -#DOC: https://earthsystemmodeling.org/docs/nightly/develop/ESMC_crefdoc/node5.html#SECTION05063000000000000000 -# https://cpp.hotexamples.com/examples/-/-/ESMC_MeshAddNodes/cpp-esmc_meshaddnodes-function-examples.html - -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/ESMF_8_0_1.tar.gz" "ESMF_8_0_1.tar.gz" -tar -zxvf ESMF_8_0_1.tar.gz -mv ESMF_8_0_1 esmf -export ESMF_DIR=$ISSM_DIR/externalpackages/esmf/esmf -export ESMF_INSTALL_PREFIX=$ISSM_DIR/externalpackages/esmf/install - -#Compile and install esmf -cd esmf -if [ $# -eq 0 ]; then - make - make install -else - make -j $1 - make -j $1 install -fi +## Sources +# - https://earthsystemmodeling.org/docs/nightly/develop/ESMC_crefdoc/node5.html#SECTION05063000000000000000 +# - https://cpp.hotexamples.com/examples/-/-/ESMC_MeshAddNodes/cpp-esmc_meshaddnodes-function-examples.html + +## Constants +# +PREFIX="${ISSM_DIR}/externalpackages/math77/install" # Set to location where external package should be installed + +VER="8_0_1" + +export ESMF_DIR="${ISSM_DIR}/externalpackages/esmf/src" +export ESMF_INSTALL_PREFIX="${PREFIX}" + +# Cleanup +rm -rf ${PREFIX} src + +# Download source +${ISSM_DIR}/scripts/DownloadExternalPackage.sh "https://github.com/esmf-org/esmf/archive/refs/tags/ESMF_${VER}.tar.gz" "ESMF_${VER}.tar.gz" + +# Unpack source +tar -zxvf ESMF_${VER}.tar.gz +mv esmf-ESMF_${VER} ${ESMF_DIR} + +# Compile and install +cd ${ESMF_DIR} +make +make install diff --git a/externalpackages/gmt/configs/6.6/cmake/ConfigUserAdvancedTemplate.cmake.patch b/externalpackages/gmt/configs/6.6/cmake/ConfigUserAdvancedTemplate.cmake.patch new file mode 100644 index 000000000..aa54943b8 --- /dev/null +++ b/externalpackages/gmt/configs/6.6/cmake/ConfigUserAdvancedTemplate.cmake.patch @@ -0,0 +1,72 @@ +--- src/cmake/ConfigUserAdvancedTemplate.cmake 2026-01-29 12:44:03 ++++ src/cmake/ConfigUser.cmake 2026-01-29 12:45:30 +@@ -46,12 +46,12 @@ + #set (GMT_INSTALL_TRADITIONAL_FOLDERNAMES OFF) + + # Make executables relocatable on supported platforms (relative RPATH) [FALSE]: +-#set (GMT_INSTALL_RELOCATABLE TRUE) ++set (GMT_INSTALL_RELOCATABLE TRUE) + + # Exclude optional GEOS, PCRE, PCRE2, FFTW3, LAPACK, BLAS, ZLIB dependencies even if you have them installed [FALSE] + #set (GMT_EXCLUDE_GEOS TRUE) +-#set (GMT_EXCLUDE_PCRE TRUE) +-#set (GMT_EXCLUDE_PCRE2 TRUE) ++set (GMT_EXCLUDE_PCRE TRUE) ++set (GMT_EXCLUDE_PCRE2 TRUE) + #set (GMT_EXCLUDE_FFTW3 TRUE) + #set (GMT_EXCLUDE_LAPACK TRUE) + #set (GMT_EXCLUDE_BLAS TRUE) +@@ -100,11 +100,11 @@ + + # Set location of NetCDF (can be root directory, path to header file or path + # to nc-config) [auto]: +-#set (NETCDF_ROOT "netcdf_install_prefix") ++#set (NETCDF_ROOT "$ENV{NETCDF_ROOT}") + + # Set location of GDAL (can be root directory, path to header file or path to + # gdal-config) [auto]: +-#set (GDAL_ROOT "gdal_install_prefix") ++#set (GDAL_ROOT "$ENV{GDAL_ROOT}") + + # Set location of GEOS (can be root directory, path to header file or path to + # geos-config) [auto]: +@@ -122,10 +122,10 @@ + #set (FFTW3_ROOT "fftw_install_prefix") + + # Set location of ZLIB (can be root directory or path to header file) [auto]: +-#set (ZLIB_ROOT "zlib_install_prefix") ++#set (ZLIB_ROOT "$ENV{ZLIB_ROOT}") + + # Set location of CURL (can be root directory or path to header file) [auto]: +-#set (CURL_ROOT "curl_install_prefix") ++#set (CURL_ROOT "$ENV{CURL_ROOT}") + + # Set location of OpenMP (can be root directory or path to header file) [auto]: + # CMake sometimes may fail to find the OpenMP library (libomp) on macOS. +@@ -133,7 +133,7 @@ + + # Set location of GLIB component gthread [auto]. This is an optional (and + # experimental) option which you need to enable or disable: +-set (GMT_USE_THREADS TRUE) ++#set (GMT_USE_THREADS TRUE) + # If pkg-config is not installed (e.g. on Windows) you need to specify these: + #set (GLIB_INCLUDE_DIR c:/path/to/glib-dev/include/glib-2.0) + #set (GLIB_LIBRARIES c:/path/to/glib-dev/lib/glib-2.0.lib) +@@ -152,7 +152,7 @@ + #set (LICENSE_RESTRICTED GPL) + + # Allow building of OpenMP if compiler supports it +-set (GMT_ENABLE_OPENMP TRUE) ++#set (GMT_ENABLE_OPENMP TRUE) + + # Configure default units (possible values are SI and US) [SI]: + #set (UNITS "US") +@@ -167,7 +167,7 @@ + #set (CMAKE_POSITION_INDEPENDENT_CODE TRUE) + + # Build GMT shared lib with supplemental modules [TRUE]: +-#set (BUILD_SUPPLEMENTS FALSE) ++set (BUILD_SUPPLEMENTS FALSE) + + # Build/Install GMT Developer include files [TRUE]: + # This installs the extra include files and configured files needed by 3rd-party diff --git a/externalpackages/gmt/configs/6.6/mac/cmake/modules/ConfigCMake.cmake.patch b/externalpackages/gmt/configs/6.6/mac/cmake/modules/ConfigCMake.cmake.patch new file mode 100644 index 000000000..4d467b8d8 --- /dev/null +++ b/externalpackages/gmt/configs/6.6/mac/cmake/modules/ConfigCMake.cmake.patch @@ -0,0 +1,11 @@ +--- ./src/cmake/modules/ConfigCMake.cmake 2024-01-07 01:32:40 ++++ ./ConfigCMake.cmake 2024-03-23 11:21:06 +@@ -195,7 +195,7 @@ + # CMP0042: CMake 3.0: MACOSX_RPATH is enabled by default + set (CMAKE_MACOSX_RPATH ON) + set (CMAKE_INSTALL_NAME_DIR @rpath) +- set (CMAKE_INSTALL_RPATH "@rpath;@executable_path/${_rpath}") ++ set (CMAKE_INSTALL_RPATH "@rpath;@executable_path/${_rpath};${LIBGFORTRAN_ROOT}") + else (APPLE) + # relative RPATH on Linux, Solaris, etc. + set (CMAKE_INSTALL_RPATH "\$ORIGIN/${_rpath}") diff --git a/externalpackages/gmt/configs/6.6/static/cmake/ConfigUserAdvancedTemplate.cmake.patch b/externalpackages/gmt/configs/6.6/static/cmake/ConfigUserAdvancedTemplate.cmake.patch new file mode 100644 index 000000000..bfe7e1a2d --- /dev/null +++ b/externalpackages/gmt/configs/6.6/static/cmake/ConfigUserAdvancedTemplate.cmake.patch @@ -0,0 +1,63 @@ +--- src/cmake/ConfigUserAdvancedTemplate.cmake 2025-07-23 03:39:53 ++++ src/cmake/ConfigUser.cmake 2026-01-29 12:55:46 +@@ -46,12 +46,12 @@ + #set (GMT_INSTALL_TRADITIONAL_FOLDERNAMES OFF) + + # Make executables relocatable on supported platforms (relative RPATH) [FALSE]: +-#set (GMT_INSTALL_RELOCATABLE TRUE) ++set (GMT_INSTALL_RELOCATABLE TRUE) + + # Exclude optional GEOS, PCRE, PCRE2, FFTW3, LAPACK, BLAS, ZLIB dependencies even if you have them installed [FALSE] + #set (GMT_EXCLUDE_GEOS TRUE) +-#set (GMT_EXCLUDE_PCRE TRUE) +-#set (GMT_EXCLUDE_PCRE2 TRUE) ++set (GMT_EXCLUDE_PCRE TRUE) ++set (GMT_EXCLUDE_PCRE2 TRUE) + #set (GMT_EXCLUDE_FFTW3 TRUE) + #set (GMT_EXCLUDE_LAPACK TRUE) + #set (GMT_EXCLUDE_BLAS TRUE) +@@ -100,11 +100,11 @@ + + # Set location of NetCDF (can be root directory, path to header file or path + # to nc-config) [auto]: +-#set (NETCDF_ROOT "netcdf_install_prefix") ++#set (NETCDF_ROOT "$ENV{NETCDF_ROOT}") + + # Set location of GDAL (can be root directory, path to header file or path to + # gdal-config) [auto]: +-#set (GDAL_ROOT "gdal_install_prefix") ++#set (GDAL_ROOT "$ENV{GDAL_ROOT}") + + # Set location of GEOS (can be root directory, path to header file or path to + # geos-config) [auto]: +@@ -122,10 +122,10 @@ + #set (FFTW3_ROOT "fftw_install_prefix") + + # Set location of ZLIB (can be root directory or path to header file) [auto]: +-#set (ZLIB_ROOT "zlib_install_prefix") ++#set (ZLIB_ROOT "$ENV{ZLIB_ROOT}") + + # Set location of CURL (can be root directory or path to header file) [auto]: +-#set (CURL_ROOT "curl_install_prefix") ++#set (CURL_ROOT "$ENV{CURL_ROOT}") + + # Set location of OpenMP (can be root directory or path to header file) [auto]: + # CMake sometimes may fail to find the OpenMP library (libomp) on macOS. +@@ -167,7 +167,7 @@ + #set (CMAKE_POSITION_INDEPENDENT_CODE TRUE) + + # Build GMT shared lib with supplemental modules [TRUE]: +-#set (BUILD_SUPPLEMENTS FALSE) ++set (BUILD_SUPPLEMENTS FALSE) + + # Build/Install GMT Developer include files [TRUE]: + # This installs the extra include files and configured files needed by 3rd-party +@@ -283,7 +283,7 @@ + #set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS c:/Windows/System32/msvcr100.dll) + + # If your NetCDF library is static (not recommended, applies to Windows only) +-#set (NETCDF_STATIC TRUE) ++set (NETCDF_STATIC TRUE) + + # If want to rename the DLLs to something else than the default (e.g. to + # append the bitness - Windows only) diff --git a/externalpackages/gmt/configs/6.6/static/cmake/modules/FindGDAL.cmake.patch b/externalpackages/gmt/configs/6.6/static/cmake/modules/FindGDAL.cmake.patch new file mode 100644 index 000000000..bffab2859 --- /dev/null +++ b/externalpackages/gmt/configs/6.6/static/cmake/modules/FindGDAL.cmake.patch @@ -0,0 +1,90 @@ +--- src/cmake/modules/FindGDAL.cmake 2024-01-07 01:32:40 ++++ FindGDAL.cmake 2024-03-31 19:36:43 +@@ -81,12 +81,25 @@ + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE GDAL_CONFIG_LIBS) + if (GDAL_CONFIG_LIBS) +- string (REGEX MATCHALL "-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS}) +- string (REGEX REPLACE "-l" "" _gdal_lib "${_gdal_dashl}") +- string (REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS}) +- string (REGEX REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}") ++ string (REGEX MATCHALL "(^| )-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS}) ++ string (REGEX REPLACE "(^| )-l" "" _gdal_lib "${_gdal_dashl}") ++ string (REGEX MATCHALL "(^| )-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS}) ++ string (REGEX REPLACE "(^| )-L" "" _gdal_libpath "${_gdal_dashL}") + endif (GDAL_CONFIG_LIBS) ++ execute_process (COMMAND ${GDAL_CONFIG} --dep-libs ++ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ++ OUTPUT_VARIABLE GDAL_CONFIG_DEP_LIBS) ++ if (GDAL_CONFIG_DEP_LIBS) ++ string (REGEX MATCHALL "(^| )-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_DEP_LIBS}) ++ string (REGEX REPLACE "(^| )-l" "" _gdal_dep_lib "${_gdal_dashl}") ++ string (REGEX MATCHALL "(^| )-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_DEP_LIBS}) ++ string (REGEX REPLACE "(^| )-L" "" _gdal_dep_libpath "${_gdal_dashL}") ++ endif (GDAL_CONFIG_DEP_LIBS) + endif (GDAL_CONFIG) ++ if (_gdal_dep_lib) ++ list (REMOVE_DUPLICATES _gdal_dep_lib) ++ list (REMOVE_ITEM _gdal_dep_lib gdal) ++ endif (_gdal_dep_lib) + endif (UNIX AND NOT GDAL_FOUND) + + find_path (GDAL_INCLUDE_DIR gdal.h +@@ -129,6 +142,57 @@ + /usr/local + ) + ++# find all libs that gdal-config --dep-libs reports ++foreach (_extralib ${_gdal_dep_lib}) ++ find_library (_found_lib_${_extralib} ++ NAMES ${_extralib} ++ HINTS ++ ${HDF5_ROOT} ++ $ENV{HDF5_ROOT} ++ ${NETCDF_ROOT} ++ $ENV{NETCDF_ROOT} ++ ${ZLIB_ROOT} ++ $ENV{ZLIB_ROOT} ++ ${CURL_ROOT} ++ $ENV{CURL_ROOT} ++ PATH_SUFFIXES lib ++ PATHS ++ ${_gdal_dep_libpath} ++ ) ++ list (APPEND GDAL_LIBRARY ${_found_lib_${_extralib}}) ++endforeach (_extralib) ++ ++# append manually-supplied libs ++# find all manually-supplied libs ++if (GDAL_EXTRA_LIBS) ++ # Ensure -l is preceded by whitespace to not match ++ # '-l' in '-L/usr/lib/x86_64-linux-gnu/hdf5/serial' ++ string (REGEX MATCHALL "(^| )-l[^ ]+" _gdal_extra_lib_dashl ${GDAL_EXTRA_LIBS}) ++ string (REGEX REPLACE "(^| )-l" "" _gdal_extra_lib "${_gdal_extra_lib_dashl}") ++ string (REGEX MATCHALL "(^| )-L[^ ]+" _gdal_extra_lib_dashL ${GDAL_EXTRA_LIBS}) ++ string (REGEX REPLACE "(^| )-L" "" _gdal_extra_libpath "${_gdal_extra_lib_dashL}") ++ foreach (_extralib ${_gdal_extra_lib}) ++ find_library (_found_lib_${_extralib} ++ NAMES ${_extralib} ++ PATH_SUFFIXES lib ++ PATHS ++ ${_gdal_extra_libpath} ++ ) ++ list (APPEND GDAL_LIBRARY ${_found_lib_${_extralib}}) ++ endforeach (_extralib) ++ # Retrieve static library names ++ string(REGEX MATCHALL "[-_/a-zA-Z0-9]+\\.a" _gdal_extra_static_lib "${GDAL_EXTRA_LIBS}") ++ foreach (_extralib ${_gdal_extra_static_lib}) ++ find_library (${_extralib} ++ NAMES ${_extralib} ++ PATH_SUFFIXES lib ++ PATHS ++ ${_gdal_extra_libpath} ++ ) ++ list (APPEND GDAL_LIBRARY ${_extralib}) ++ endforeach (_extralib) ++endif (GDAL_EXTRA_LIBS) ++ + include (FindPackageHandleStandardArgs) + find_package_handle_standard_args (GDAL DEFAULT_MSG GDAL_LIBRARY GDAL_INCLUDE_DIR) + diff --git a/externalpackages/gmt/configs/6.6/static/cmake/modules/FindGLIB.cmake.patch b/externalpackages/gmt/configs/6.6/static/cmake/modules/FindGLIB.cmake.patch new file mode 100644 index 000000000..0b7bd5d45 --- /dev/null +++ b/externalpackages/gmt/configs/6.6/static/cmake/modules/FindGLIB.cmake.patch @@ -0,0 +1,59 @@ +--- src/cmake/modules/FindGLIB.cmake 2024-01-07 01:32:40 ++++ FindGLIB.cmake 2024-04-01 19:59:40 +@@ -46,15 +46,50 @@ + find_package(PkgConfig) + pkg_check_modules(PC_GLIB QUIET glib-2.0) + +-find_library(GLIB_LIBRARIES +- NAMES glib-2.0 +- HINTS ${PC_GLIB_LIBDIR} +- ${PC_GLIB_LIBRARY_DIRS} +-) ++if (GLIB_LIBRARY) ++ # Ensure -l is preceded by whitespace to not match ++ # '-l' in '-L/usr/lib/x86_64-linux-gnu/hdf5/serial' ++ string (REGEX MATCHALL "(^| )-l[^ ]+" _glib_lib_dashl ${GLIB_LIBRARY}) ++ string (REGEX REPLACE "(^| )-l" "" _glib_lib "${_glib_lib_dashl}") ++ string (REGEX MATCHALL "(^| )-L[^ ]+" _glib_lib_dashL ${GLIB_LIBRARY}) ++ string (REGEX REPLACE "(^| )-L" "" _glib_libpath "${_glib_lib_dashL}") ++ foreach (_lib ${_glib_lib}) ++ find_library (_found_lib_${_lib} ++ NAMES ${_lib} ++ PATH_SUFFIXES lib ++ PATHS ++ ${_glib_libpath} ++ ) ++ list (APPEND GLIB_LIBRARIES ${_found_lib_${_lib}}) ++ endforeach (_lib) ++ # Retrieve static library names ++ string(REGEX MATCHALL "[-_/\\.a-zA-Z0-9]+\\.a" _glib_static_lib "${GLIB_LIBRARY}") ++ foreach (_lib ${_glib_static_lib}) ++ find_library (${_lib} ++ NAMES ${_lib} ++ PATH_SUFFIXES lib ++ PATHS ++ ${_glib_libpath} ++ ) ++ list (APPEND GLIB_LIBRARIES ${_lib}) ++ endforeach (_lib) ++ # Retrieve Framework names ++ string(REGEX MATCHALL "-framework [a-zA-Z0-9]+" _glib_framework "${GLIB_LIBRARY}") ++ foreach (_framework ${_glib_framework}) ++ list (APPEND GLIB_LIBRARIES ${_framework}) ++ endforeach (_framework) ++else () ++ find_library(GLIB_LIBRARIES ++ NAMES glib-2.0 ++ HINTS ${PC_GLIB_LIBDIR} ++ ${PC_GLIB_LIBRARY_DIRS} ++ ) + ++ get_filename_component(_GLIB_LIBRARY_DIR ${GLIB_LIBRARIES} PATH) ++endif (GLIB_LIBRARY) ++ + # Files in glib's main include path may include glibconfig.h, which, + # for some odd reason, is normally in $LIBDIR/glib-2.0/include. +-get_filename_component(_GLIB_LIBRARY_DIR ${GLIB_LIBRARIES} PATH) + find_path(GLIBCONFIG_INCLUDE_DIR + NAMES glibconfig.h + HINTS ${PC_LIBDIR} ${PC_LIBRARY_DIRS} ${_GLIB_LIBRARY_DIR} diff --git a/externalpackages/gmt/configs/6.6/static/cmake/modules/FindGSHHG.cmake.patch b/externalpackages/gmt/configs/6.6/static/cmake/modules/FindGSHHG.cmake.patch new file mode 100644 index 000000000..cd1f4960d --- /dev/null +++ b/externalpackages/gmt/configs/6.6/static/cmake/modules/FindGSHHG.cmake.patch @@ -0,0 +1,13 @@ +--- src/cmake/modules/FindGSHHG.cmake 2024-01-07 01:32:40 ++++ FindGSHHG.cmake 2024-03-20 12:30:46 +@@ -52,6 +52,10 @@ + set (GSHHG_MIN_REQUIRED_VERSION + "${GSHHG_MIN_REQUIRED_VERSION_MAJOR}.${GSHHG_MIN_REQUIRED_VERSION_MINOR}.${GSHHG_MIN_REQUIRED_VERSION_PATCH}") + ++# Temporary hack to bypass failure of compilation of code to find GSHHG ++set (GSHHG_FOUND TRUE) ++set (GSHHG_VERSION "2.3.4" CACHE INTERNAL "GSHHG version") ++ + # check GSHHG version + if (_GSHHG_FILE AND NOT GSHHG_FOUND) + if (NOT CMAKE_CROSSCOMPILING) diff --git a/externalpackages/gmt/configs/6.6/static/cmake/modules/FindNETCDF.cmake.patch b/externalpackages/gmt/configs/6.6/static/cmake/modules/FindNETCDF.cmake.patch new file mode 100644 index 000000000..43f38fe9b --- /dev/null +++ b/externalpackages/gmt/configs/6.6/static/cmake/modules/FindNETCDF.cmake.patch @@ -0,0 +1,90 @@ +--- src/cmake/modules/FindNETCDF.cmake 2024-01-07 01:32:40 ++++ FindNETCDF.cmake 2024-03-31 15:12:47 +@@ -67,6 +67,23 @@ + OUTPUT_VARIABLE NETCDF_PREFIX_DIR + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) ++ execute_process(COMMAND ${NC_CONFIG} --libs ++ RESULT_VARIABLE nc_res ++ OUTPUT_VARIABLE NETCDF_LIBS ++ ERROR_QUIET ++ OUTPUT_STRIP_TRAILING_WHITESPACE) ++ if (NETCDF_LIBS) ++ # Ensure -l is preceded by whitespace to not match ++ # '-l' in '-L/usr/lib/x86_64-linux-gnu/hdf5/serial' ++ string (REGEX MATCHALL "(^| )-l[^ ]+" _netcdf_dashl ${NETCDF_LIBS}) ++ string (REGEX REPLACE "(^| )-l" "" _netcdf_lib "${_netcdf_dashl}") ++ string (REGEX MATCHALL "(^| )-L[^ ]+" _netcdf_dashL ${NETCDF_LIBS}) ++ string (REGEX REPLACE "(^| )-L" "" _netcdf_libpath "${_netcdf_dashL}") ++ if (_netcdf_lib) ++ list (REMOVE_DUPLICATES _netcdf_lib) ++ list (REMOVE_ITEM _netcdf_lib netcdf) ++ endif (_netcdf_lib) ++ endif (NETCDF_LIBS) + endif() + + find_path(NETCDF_INCLUDE_DIR netcdf.h +@@ -78,6 +95,54 @@ + "${NETCDF_INCLUDE_DIR}/../lib" + HINTS "${NETCDF_PREFIX_DIR}/lib") + ++# find all libs that nc-config reports ++foreach (_extralib ${_netcdf_lib}) ++ find_library (_found_lib_${_extralib} ++ NAMES ${_extralib} ++ HINTS ++ ${HDF5_ROOT} ++ $ENV{HDF5_ROOT} ++ ${ZLIB_ROOT} ++ $ENV{ZLIB_ROOT} ++ ${CURL_ROOT} ++ $ENV{CURL_ROOT} ++ PATH_SUFFIXES lib ++ PATHS ++ ${_netcdf_libpath} ++ ) ++ list (APPEND NETCDF_LIBRARY ${_found_lib_${_extralib}}) ++endforeach (_extralib) ++ ++# find all manually-supplied libs ++if (NETCDF_EXTRA_LIBS) ++ # Ensure -l is preceded by whitespace to not match ++ # '-l' in '-L/usr/lib/x86_64-linux-gnu/hdf5/serial' ++ string (REGEX MATCHALL "(^| )-l[^ ]+" _netcdf_extra_lib_dashl ${NETCDF_EXTRA_LIBS}) ++ string (REGEX REPLACE "(^| )-l" "" _netcdf_extra_shared_lib "${_netcdf_extra_lib_dashl}") ++ string (REGEX MATCHALL "(^| )-L[^ ]+" _netcdf_extra_lib_dashL ${NETCDF_EXTRA_LIBS}) ++ string (REGEX REPLACE "(^| )-L" "" _netcdf_extra_libpath "${_netcdf_extra_lib_dashL}") ++ foreach (_extralib ${_netcdf_extra_shared_lib}) ++ find_library (_found_lib_${_extralib} ++ NAMES ${_extralib} ++ PATH_SUFFIXES lib ++ PATHS ++ ${_netcdf_extra_libpath} ++ ) ++ list (APPEND NETCDF_LIBRARY ${_found_lib_${_extralib}}) ++ endforeach (_extralib) ++ # Retrieve static library names ++ string(REGEX MATCHALL "[-_/a-zA-Z0-9]+\\.a" _netcdf_extra_static_lib "${NETCDF_EXTRA_LIBS}") ++ foreach (_extralib ${_netcdf_extra_static_lib}) ++ find_library (${_extralib} ++ NAMES ${_extralib} ++ PATH_SUFFIXES lib ++ PATHS ++ ${_netcdf_extra_libpath} ++ ) ++ list (APPEND NETCDF_LIBRARY ${_extralib}) ++ endforeach (_extralib) ++endif (NETCDF_EXTRA_LIBS) ++ + if(NETCDF_INCLUDE_DIR AND NETCDF_LIBRARY) + set (NETCDF_C_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR}) + set (NETCDF_C_LIBRARIES ${NETCDF_LIBRARY}) +@@ -181,6 +246,8 @@ + NetCDF_check_interface (F77 netcdf.inc netcdff) + NetCDF_check_interface (F90 netcdf.mod netcdff) + ++ ++ + #export accumulated results to internal vars that rest of project can depend on + list (APPEND NetCDF_libs "${NETCDF_C_LIBRARIES}") + set (NETCDF_LIBRARIES ${NetCDF_libs}) diff --git a/externalpackages/gmt/install-6-linux-static.sh b/externalpackages/gmt/install-6-linux-static.sh index 7f45788f5..d807b5a61 100755 --- a/externalpackages/gmt/install-6-linux-static.sh +++ b/externalpackages/gmt/install-6-linux-static.sh @@ -4,7 +4,7 @@ set -e ## Constants # -VER="6.5.0" +VER="6.6.0" PREFIX="${ISSM_DIR}/externalpackages/gmt/install" diff --git a/externalpackages/gmt/install-6-linux.sh b/externalpackages/gmt/install-6-linux.sh index cb61cd3f0..4851f3d2e 100755 --- a/externalpackages/gmt/install-6-linux.sh +++ b/externalpackages/gmt/install-6-linux.sh @@ -4,7 +4,7 @@ set -e ## Constants # -VER="6.5.0" +VER="6.6.0" PREFIX="${ISSM_DIR}/externalpackages/gmt/install" diff --git a/externalpackages/gmt/install-6-mac-static.sh b/externalpackages/gmt/install-6-mac-static.sh index becc35c40..30f85bfcb 100755 --- a/externalpackages/gmt/install-6-mac-static.sh +++ b/externalpackages/gmt/install-6-mac-static.sh @@ -13,7 +13,7 @@ set -e ## Constants # -VER="6.5.0" +VER="6.6.0" PREFIX="${ISSM_DIR}/externalpackages/gmt/install" diff --git a/externalpackages/gmt/install-6-mac.sh b/externalpackages/gmt/install-6-mac.sh index e8f6165d8..1cb91d2fb 100755 --- a/externalpackages/gmt/install-6-mac.sh +++ b/externalpackages/gmt/install-6-mac.sh @@ -4,7 +4,7 @@ set -e ## Constants # -VER="6.5.0" +VER="6.6.0" PREFIX="${ISSM_DIR}/externalpackages/gmt/install" diff --git a/externalpackages/gmt/install-6-pleiades.sh b/externalpackages/gmt/install-6-pleiades.sh index 8c46d8b6a..894b10af4 100755 --- a/externalpackages/gmt/install-6-pleiades.sh +++ b/externalpackages/gmt/install-6-pleiades.sh @@ -4,7 +4,7 @@ set -e ## Constants # -VER="6.5.0" +VER="6.6.0" PREFIX="${ISSM_DIR}/externalpackages/gmt/install" diff --git a/externalpackages/math77/install.sh b/externalpackages/math77/install.sh deleted file mode 100755 index fad9c7ecd..000000000 --- a/externalpackages/math77/install.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -set -eu - -#Some cleanup -rm -rf src install math77 -mkdir src install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/math77.tar.gz' 'math77.tar.gz' - -#Untar -tar -zxvf math77.tar.gz - -#Move math77 into src directory -mv math77/* src -rm -rf math77 - -#Configure math77 -cd src - -#Compile math77 -if [ $# -eq 0 ]; then - make -else - make -j $1 -fi -make install diff --git a/externalpackages/modules/install-linux.sh b/externalpackages/modules/install-linux.sh new file mode 100644 index 000000000..2b6e4928c --- /dev/null +++ b/externalpackages/modules/install-linux.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -eu + + +## Constants +# +PREFIX="${ISSM_DIR}/externalpackages/modules/install" # Set to location where external package should be installed + +VER="5.6.1" + +# Cleanup +rm -rf ${PREFIX} src + +# Download source +${ISSM_DIR}/scripts/DownloadExternalPackage.sh "https://github.com/envmodules/modules/archive/refs/tags/v${VER}.tar.gz" "v${VER}.tar.gz" + +# Unpack source +tar -zxvf v${VER}.tar.gz +mv modules-${VER} src + +# Configure +cd src +./configure \ + --prefix "${PREFIX}" \ + --without-x + +# Compile and install +make +make install diff --git a/externalpackages/modules/install-mac.sh b/externalpackages/modules/install-mac.sh new file mode 100755 index 000000000..1a02413e1 --- /dev/null +++ b/externalpackages/modules/install-mac.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -eu + + +## Constants +# +PREFIX="${ISSM_DIR}/externalpackages/modules/install" # Set to location where external package should be installed + +VER="5.6.1" + +# Cleanup +rm -rf ${PREFIX} src + +# Download source +${ISSM_DIR}/scripts/DownloadExternalPackage.sh "https://github.com/envmodules/modules/archive/refs/tags/v${VER}.tar.gz" "v${VER}.tar.gz" + +# Unpack source +tar -zxvf v${VER}.tar.gz +mv modules-${VER} src + +# Configure +cd src +./configure \ + --prefix "${PREFIX}" \ + --with-tcl-lib="${ISSM_DIR}/externalpackages/tcl/install/lib" \ + --with-tcl-inc="${ISSM_DIR}/externalpackages/tcl/install/include" \ + --with-tcl-ver=8.5 \ + --with-tclx-lib="${ISSM_DIR}/externalpackages/tclx/install/lib/tclx8.4" \ + --with-tclx-inc="${ISSM_DIR}/externalpackagestclx/install/include" \ + --with-tclx-ver=8.4 \ + --with-version-path=/usr/local/modules/versions \ + --with-skel-path=/usr/local/modules/etc/skel \ + --with-etc-path=/usr/local/modules/etc \ + --with-module-path=/usr/local/modules/files \ + --disable-dependency-tracking + +# Compile and install +make +sudo make install diff --git a/externalpackages/modules/install-macosx64.sh b/externalpackages/modules/install-macosx64.sh deleted file mode 100755 index 5d40aee2b..000000000 --- a/externalpackages/modules/install-macosx64.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -set -eu - -#Some cleanup -rm -rf install -rm -rf modules-3.2.9c -mkdir install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/modules-3.2.9c.tar.gz' 'modules-3.2.9c.tar.gz' - -#Untar -tar -zxvf modules-3.2.9c.tar.gz - -#Move modules into src directory - -#Configure modules -cd modules-3.2.9 -./configure \ - --prefix=$ISSM_DIR/externalpackages/modules/install\ - --with-tcl-lib=$ISSM_DIR/externalpackages/tcl/install/lib\ - --with-tcl-inc=$ISSM_DIR/externalpackages/tcl/install/include\ - --with-tcl-ver=8.5 \ - --with-tclx-lib=$ISSM_DIR/externalpackages/tclx/install/lib/tclx8.4\ - --with-tclx-inc=$ISSM_DIR/externalpackages/tclx/install/include\ - --with-tclx-ver=8.4 \ - --with-version-path=/usr/local/modules/versions \ - --with-skel-path=/usr/local/modules/etc/skel \ - --with-etc-path=/usr/local/modules/etc \ - --with-module-path=/usr/local/modules/files \ - --disable-dependency-tracking - -#Compile and install modules -if [ $# -eq 0 ]; then - make -else - make -j $1 -fi -sudo make install diff --git a/externalpackages/modules/install.sh b/externalpackages/modules/install.sh deleted file mode 100755 index 602ea4c2d..000000000 --- a/externalpackages/modules/install.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -eu - -#Some cleanup -rm -rf install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh https://issm.ess.uci.edu/files/externalpackages/modules-3.2.9c.tar.gz modules-3.2.9c.tar.gz - -#Untar and move python into install directory -tar -zxvf modules-3.2.9c.tar.gz -mv modules-3.2.9 install - -#Configure doxygen -cd install -./configure \ - --prefix "$ISSM_DIR/externalpackages/modules/install" \ - --without-x - -#compile and install -make -make install diff --git a/externalpackages/pcatool/install.sh b/externalpackages/pcatool/install.sh deleted file mode 100755 index f9a4f9f4b..000000000 --- a/externalpackages/pcatool/install.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -#Some cleanup -rm -rf install pcatool -mkdir install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/pcatool.tar.gz' 'pcatool.tar.gz' - -#Untar into install -cd install -tar -zxvf ../pcatool.tar.gz diff --git a/externalpackages/petsc/install-3.14-discover.sh b/externalpackages/petsc/install-3.14-discover.sh index e65fd52e5..c256a2aff 100755 --- a/externalpackages/petsc/install-3.14-discover.sh +++ b/externalpackages/petsc/install-3.14-discover.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.14-greenplanet.sh b/externalpackages/petsc/install-3.14-greenplanet.sh index a985a4fb2..b02be2161 100755 --- a/externalpackages/petsc/install-3.14-greenplanet.sh +++ b/externalpackages/petsc/install-3.14-greenplanet.sh @@ -12,7 +12,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.14-linux-static.sh b/externalpackages/petsc/install-3.14-linux-static.sh index 389cfd590..b51569359 100755 --- a/externalpackages/petsc/install-3.14-linux-static.sh +++ b/externalpackages/petsc/install-3.14-linux-static.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.14-linux.sh b/externalpackages/petsc/install-3.14-linux.sh index 1fa189b05..d2c6d9532 100755 --- a/externalpackages/petsc/install-3.14-linux.sh +++ b/externalpackages/petsc/install-3.14-linux.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.14-mac-static.sh b/externalpackages/petsc/install-3.14-mac-static.sh index 6c7f673d8..faff2b740 100755 --- a/externalpackages/petsc/install-3.14-mac-static.sh +++ b/externalpackages/petsc/install-3.14-mac-static.sh @@ -10,7 +10,7 @@ PETSC_DIR=${ISSM_DIR}/externalpackages/petsc/src # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.14-mac-with-hdf5-static.sh b/externalpackages/petsc/install-3.14-mac-with-hdf5-static.sh index 15f471081..249053d06 100755 --- a/externalpackages/petsc/install-3.14-mac-with-hdf5-static.sh +++ b/externalpackages/petsc/install-3.14-mac-with-hdf5-static.sh @@ -10,7 +10,7 @@ PETSC_DIR=${ISSM_DIR}/externalpackages/petsc/src # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.14-mac-with-hdf5.sh b/externalpackages/petsc/install-3.14-mac-with-hdf5.sh index f28710fa9..459cb4613 100755 --- a/externalpackages/petsc/install-3.14-mac-with-hdf5.sh +++ b/externalpackages/petsc/install-3.14-mac-with-hdf5.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.14-mac.sh b/externalpackages/petsc/install-3.14-mac.sh index c52a370b6..8b810886b 100755 --- a/externalpackages/petsc/install-3.14-mac.sh +++ b/externalpackages/petsc/install-3.14-mac.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.14-pleiades.sh b/externalpackages/petsc/install-3.14-pleiades.sh index 9f91771cb..a6d0d9cb8 100755 --- a/externalpackages/petsc/install-3.14-pleiades.sh +++ b/externalpackages/petsc/install-3.14-pleiades.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.15-babylon.sh b/externalpackages/petsc/install-3.15-babylon.sh index e9ded25da..aef6c9311 100755 --- a/externalpackages/petsc/install-3.15-babylon.sh +++ b/externalpackages/petsc/install-3.15-babylon.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.15-discovery.sh b/externalpackages/petsc/install-3.15-discovery.sh index 1200c2553..e4d618c8d 100755 --- a/externalpackages/petsc/install-3.15-discovery.sh +++ b/externalpackages/petsc/install-3.15-discovery.sh @@ -9,7 +9,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.15-pleiades.sh b/externalpackages/petsc/install-3.15-pleiades.sh index c94ee0917..0180a060f 100755 --- a/externalpackages/petsc/install-3.15-pleiades.sh +++ b/externalpackages/petsc/install-3.15-pleiades.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.16-linux.sh b/externalpackages/petsc/install-3.16-linux.sh index 27a2d3500..feb2d2e66 100755 --- a/externalpackages/petsc/install-3.16-linux.sh +++ b/externalpackages/petsc/install-3.16-linux.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.16-mac.sh b/externalpackages/petsc/install-3.16-mac.sh index 27a2d3500..feb2d2e66 100755 --- a/externalpackages/petsc/install-3.16-mac.sh +++ b/externalpackages/petsc/install-3.16-mac.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.16-pleiades.sh b/externalpackages/petsc/install-3.16-pleiades.sh index 3efa847c4..d8bd92f50 100755 --- a/externalpackages/petsc/install-3.16-pleiades.sh +++ b/externalpackages/petsc/install-3.16-pleiades.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.17-discovery.sh b/externalpackages/petsc/install-3.17-discovery.sh index ed748ee03..ad28d6b23 100755 --- a/externalpackages/petsc/install-3.17-discovery.sh +++ b/externalpackages/petsc/install-3.17-discovery.sh @@ -9,7 +9,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.17-linux-static.sh b/externalpackages/petsc/install-3.17-linux-static.sh index 57b8f2ec1..113cf9612 100755 --- a/externalpackages/petsc/install-3.17-linux-static.sh +++ b/externalpackages/petsc/install-3.17-linux-static.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.17-linux.sh b/externalpackages/petsc/install-3.17-linux.sh index f28ac27ce..afcceb9cb 100755 --- a/externalpackages/petsc/install-3.17-linux.sh +++ b/externalpackages/petsc/install-3.17-linux.sh @@ -8,7 +8,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.17-mac-intel.sh b/externalpackages/petsc/install-3.17-mac-intel.sh index 2cccb457e..5fdb9c7c2 100755 --- a/externalpackages/petsc/install-3.17-mac-intel.sh +++ b/externalpackages/petsc/install-3.17-mac-intel.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.17-mac-silicon-static.sh b/externalpackages/petsc/install-3.17-mac-silicon-static.sh index 6ea0da6e4..bf6a05781 100755 --- a/externalpackages/petsc/install-3.17-mac-silicon-static.sh +++ b/externalpackages/petsc/install-3.17-mac-silicon-static.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.17-mac-silicon.sh b/externalpackages/petsc/install-3.17-mac-silicon.sh index d9940742a..ad4279c77 100755 --- a/externalpackages/petsc/install-3.17-mac-silicon.sh +++ b/externalpackages/petsc/install-3.17-mac-silicon.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.17-pleiades.sh b/externalpackages/petsc/install-3.17-pleiades.sh index 31305a013..fa47ef9b1 100755 --- a/externalpackages/petsc/install-3.17-pleiades.sh +++ b/externalpackages/petsc/install-3.17-pleiades.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.20-linux-static.sh b/externalpackages/petsc/install-3.20-linux-static.sh index c66eb89ed..eb44820ed 100755 --- a/externalpackages/petsc/install-3.20-linux-static.sh +++ b/externalpackages/petsc/install-3.20-linux-static.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.20-linux.sh b/externalpackages/petsc/install-3.20-linux.sh index 6fb289b9e..dfa87bc00 100755 --- a/externalpackages/petsc/install-3.20-linux.sh +++ b/externalpackages/petsc/install-3.20-linux.sh @@ -9,7 +9,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.20-mac-static.sh b/externalpackages/petsc/install-3.20-mac-static.sh index f52640e2c..9d43b3057 100755 --- a/externalpackages/petsc/install-3.20-mac-static.sh +++ b/externalpackages/petsc/install-3.20-mac-static.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.20-mac.sh b/externalpackages/petsc/install-3.20-mac.sh index 4d9d5915e..f0e65e1a8 100755 --- a/externalpackages/petsc/install-3.20-mac.sh +++ b/externalpackages/petsc/install-3.20-mac.sh @@ -10,7 +10,7 @@ PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-lite-${VER}.tar.gz" "petsc-${VER}.tar.gz" # Unpack source tar -zxvf petsc-${VER}.tar.gz diff --git a/externalpackages/petsc/install-3.23-andes.sh b/externalpackages/petsc/install-3.23-andes.sh new file mode 100755 index 000000000..f2a5fda14 --- /dev/null +++ b/externalpackages/petsc/install-3.23-andes.sh @@ -0,0 +1,48 @@ +#!/bin/bash +set -eu + +## Constants +VER="3.23.6" + +PETSC_DIR="${ISSM_DIR}/externalpackages/petsc/src" # DO NOT CHANGE THIS +PREFIX="${ISSM_DIR}/externalpackages/petsc/install" # Set to location where external package should be installed + +# Download source +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://web.cels.anl.gov/projects/petsc/download/release-snapshots/petsc-${VER}.tar.gz" "petsc-${VER}.tar.gz" + +# Unpack source +tar -zxvf petsc-${VER}.tar.gz + +# Cleanup +rm -rf ${PREFIX} ${PETSC_DIR} +mkdir -p ${PETSC_DIR} + +# Move source to $PETSC_DIR +mv petsc-${VER}/* ${PETSC_DIR} +rm -rf petsc-${VER} + +#CC=icx CXX=icx FC=ifx \ + +# Configure +cd ${PETSC_DIR} +./configure \ + CC=icx CXX=icpx FC=ifx \ + COPTFLAGS="-g -O3" CXXOPTFLAGS="-g -O3" FOPTFLAGS="-g -O3" \ + --prefix="${PREFIX}" \ + --PETSC_DIR="${PETSC_DIR}" \ + --with-make-np=20 \ + --with-debugging=0 \ + --with-valgrind=0 \ + --with-x=0 \ + --with-ssl=0 \ + --with-pic=1 \ + --with-blas-lapack-dir=$MKL_ROOT \ + --download-metis=1 \ + --download-mpich=1 \ + --download-parmetis=1 \ + --download-scalapack=1 \ + --download-mumps=1 + +# Compile and install +make +make install diff --git a/externalpackages/scotch/Makefile.inc b/externalpackages/scotch/Makefile.inc deleted file mode 100644 index 352576ae8..000000000 --- a/externalpackages/scotch/Makefile.inc +++ /dev/null @@ -1,26 +0,0 @@ -EXE = -LIB = .a -OBJ = .o -MEX = .mexa64 - -MAKE = make -AR = ar -ARFLAGS = -ruv -CAT = cat -CCS = gcc -CCP = mpicc -CCD = mpicc -CCM = ${MATLAB_DIR}/bin/mex -#CFLAGS = -m64 -O3 -std=c99 -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -DMATLAB -fPIC -I${MATLAB_DIR}/extern/include -CFLAGS = -m64 -O3 -std=c99 -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -fPIC -#LDFLAGS = -lz -lm -lrt -L${MATLAB_DIR}/bin/glnxa64 -lmex -lmat -#LDFLAGS = -lz -lm -lrt -Wl,-rpath-link,${MATLAB_DIR}/bin/glnxa64 -L${MATLAB_DIR}/bin/glnxa64 -lmex -lmat -LDFLAGS = -lz -lm -lrt -MFLAGS = -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -DNOFILEIO -DMATLAB -I${MATLAB_DIR}/extern/include -largeArrayDims -CP = cp -LEX = flex -LN = ln -MKDIR = mkdir -MV = mv -RANLIB = ranlib -YACC = yacc diff --git a/externalpackages/scotch/Makefile.inc.mac b/externalpackages/scotch/Makefile.inc.mac deleted file mode 100644 index 629a57d86..000000000 --- a/externalpackages/scotch/Makefile.inc.mac +++ /dev/null @@ -1,26 +0,0 @@ -EXE = -LIB = .a -OBJ = .o -MEX = .mexa64 - -MAKE = make -AR = ar -ARFLAGS = -ruv -CAT = cat -CCS = gcc -CCP = mpicc -CCD = mpicc -CCM = ${MATLAB_DIR}/bin/mex -#CFLAGS = -m64 -O3 -std=c99 -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -DMATLAB -fPIC -I${MATLAB_DIR}/extern/include -CFLAGS = -m64 -O3 -std=c99 -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -fPIC -#LDFLAGS = -lz -lm -L${MATLAB_DIR}/bin/glnxa64 -lmex -lmat -#LDFLAGS = -lz -lm -Wl,-rpath-link,${MATLAB_DIR}/bin/glnxa64 -L${MATLAB_DIR}/bin/glnxa64 -lmex -lmat -LDFLAGS = -lz -lm -MFLAGS = -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -DNOFILEIO -DMATLAB -I${MATLAB_DIR}/extern/include -largeArrayDims -CP = cp -LEX = flex -LN = ln -MKDIR = mkdir -MV = mv -RANLIB = ranlib -YACC = yacc diff --git a/externalpackages/scotch/configs/6.0/linux/Makefile.inc.linux-parallel-static b/externalpackages/scotch/configs/6.0/linux/Makefile.inc.linux-parallel-static deleted file mode 100644 index ced8a5394..000000000 --- a/externalpackages/scotch/configs/6.0/linux/Makefile.inc.linux-parallel-static +++ /dev/null @@ -1,21 +0,0 @@ -EXE = -LIB = .a -OBJ = .o - -MAKE = make -AR = ar -ARFLAGS = -ruv -CAT = cat -CCS = gcc -CCP = ${ISSM_DIR}/externalpackages/mpich/install/bin/mpicc -CCD = gcc -CFLAGS = -O3 -fPIC -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_PTHREAD -Drestrict=__restrict -DIDXSIZE64 -CLIBFLAGS = -LDFLAGS = -lz -lm -lrt -pthread -CP = cp -LEX = flex -Pscotchyy -olex.yy.c -LN = ln -MKDIR = mkdir -p -MV = mv -RANLIB = ranlib -YACC = bison -pscotchyy -y -b y diff --git a/externalpackages/scotch/gmap.m b/externalpackages/scotch/gmap.m deleted file mode 100644 index 3154f2a72..000000000 --- a/externalpackages/scotch/gmap.m +++ /dev/null @@ -1,66 +0,0 @@ -% -% function to call the gmap module of the scotch partitioner. -% -% [maptab]=gmap(adj_mat,vlist,vwgt,ewgt,atype,apar,... -% options) -% -% where the required input is: -% adj_mat (double [sparse nv x nv], vertex adjacency matrix) -% vlist (double [nv], vertex labels or []) -% vwgt (double [nv], vertex weights (integers) or []) -% ewgt (double [sparse nv x nv], edge weights (integers) or []) -% atype (character, architecture type) -% 'cmplt' complete graph -% 'cmpltw' weighted complete graph -% 'hcub' binary hypercube -% 'leaf' tree-leaf architecture -% 'mesh2d' bidimensional array -% 'mesh3d' tridimensional array -% 'torus2d' bidimensional array with wraparound edges -% 'torus3d' tridimensional array with wraparound edges -% apars (double, architecture params (corresponding to atype)) -% [size] cmplt -% [size load0 load1 ...] cmpltw -% [dim] hcub -% [height cluster weight] leaf -% [dimX dimY] mesh2d -% [dimX dimY dimZ] mesh3d -% [dimX dimY] torus2d -% [dimX dimY dimZ] torus3d -% -% the required output is: -% maptab (double [nv x 2], vertex labels and partitions) -% -% the optional input is: -% options (character, options to gmap) -% " -h : Display this help" -% " -m : Set mapping strategy (see user's manual)" -% " -s : Force unity weights on :" -% " e : edges" -% " v : vertices" -% " -V : Print program version and copyright" -% " -v : Set verbose mode to :" -% " m : mapping information" -% " s : strategy information" -% " t : timing information" -% "" -% "See default strategy with option '-vs'" -% -function [maptab]=gmap(adj_mat,vlist,vwgt,ewgt,atype,apars,... - varargin) - -if ~nargin - help gmap - return -end - -% gmap_mex uses static variables, so clear those out before every run -clear gmap_mex - -[maptab]=gmap_mex(adj_mat,vlist,vwgt,ewgt,atype,apars,... - varargin{:}); - -% doesn't hurt to clear out after every run, too -clear gmap_mex - -end diff --git a/externalpackages/scotch/gmap_mex.c b/externalpackages/scotch/gmap_mex.c deleted file mode 100644 index 56c2e4eb0..000000000 --- a/externalpackages/scotch/gmap_mex.c +++ /dev/null @@ -1,286 +0,0 @@ - -#define THISFUNCTION "Gmap" - -/* Gmap structures and prototypes */ - -#ifdef MATLAB - #include "mat.h" - #include "mex.h" - #include "matrix.h" - - #define printf mexPrintf - #define fprintf(file,...) (file == stdout || file == stderr ? mexPrintf(__VA_ARGS__) : fprintf(file,__VA_ARGS__)) - #define malloc mxMalloc - #define calloc mxCalloc - #define realloc mxRealloc - #define free mxFree - #define exit(status) mexErrMsgTxt("exit=" #status) -#endif - -void GmapUsage( void ); - - -int -gmapx ( - int (**pmaptabi)[2], - int argcm, - char *argvm[], - int nvi, - int ne2i, - int *ir, - int *jc, - int *vli, - int *vwi, - int *ewi, - char archtyp[], - int nai, - int *api); - -/******************************/ -/* */ -/* This is the main function. */ -/* */ -/******************************/ - -void mexFunction( int nlhs, - mxArray *plhs[], - int nrhs, - const mxArray *prhs[] ) -{ - int argcm; - char **argvm=NULL; - int nvert =0,nedge2=0,napar =0; - mwIndex *ir=NULL,*jc=NULL; - int *adjir=NULL,*adjjc=NULL; - double *vld=NULL,*vwd=NULL,*ewd=NULL,*apd=NULL; - int *vli=NULL,*vwi=NULL,*ewi=NULL,*api=NULL; - char *archtyp=NULL; - int (*maptabi)[2]=NULL; - double* maptabd=NULL; - int i,j,k,imi=0,imo=0,isi=0,ierr; - - /* Check for proper number of arguments */ - - if (nrhs == 0 && nlhs == 0) { - GmapUsage(); - return; - } - else if (nrhs < 6 || nlhs > 1) { - GmapUsage(); - mexErrMsgTxt(" "); - } - -/* load matlab argument list and convert to integer (note that converting here - and in the x-layer is inefficient, but it makes the x-layer more general) */ - - argvm = (char **) calloc(nrhs,sizeof(char *)); - - if (!(mxIsNumeric(prhs[imi]) && - (mxGetM(prhs[imi]) == 1 && mxGetN(prhs[imi]) == 1))) { - argvm[isi] = (char *) calloc(4+1,sizeof(char)); - strcpy(argvm[isi],"gmap"); - mexPrintf("%s -- Using \"%s\" entry point.\n", - THISFUNCTION,argvm[isi]); - isi++; - } - else { - argvm[isi] = (char *) calloc(5+1,sizeof(char)); - strcpy(argvm[isi],"gpart"); - mexPrintf("%s -- Using \"%s\" entry point.\n", - THISFUNCTION,argvm[isi]); - isi++; - - argvm[isi] = (char *) calloc(17,sizeof(char)); - sprintf(argvm[isi],"%d",(int)mxGetScalar(prhs[imi])); - mexPrintf("%s -- Number of parts is %s.\n", - THISFUNCTION,argvm[isi]); - isi++; - imi++; - } - - if (!mxIsNumeric(prhs[imi]) || (!mxIsEmpty(prhs[imi]) && !mxIsSparse(prhs[imi]))) { - mexPrintf("%s -- Adjacency matrix must be numeric and sparse.\n",THISFUNCTION); - mexErrMsgTxt(" "); - } - else { - nvert =mxGetM(prhs[imi]); - nedge2=mxGetNzmax(prhs[imi]); - if (mxGetNzmax(prhs[imi])) { - ir =mxGetIr(prhs[imi]); - adjir = (int *) malloc(mxGetNzmax(prhs[imi])*sizeof(int)); - for (i=0; i= 5) && - (strncmp (argvm[0] + strlen (argvm[0]) - 5, "gpart", 5) == 0))) { - if (!mxIsChar(prhs[imi])) { - mexPrintf("%s -- Architecture type must be character.\n",THISFUNCTION); - mexErrMsgTxt(" "); - } - else { - if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) { - archtyp = (char *) calloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])+1,sizeof(char)); - mxGetString(prhs[imi],archtyp,mxGetM(prhs[imi])*mxGetN(prhs[imi])+1); - } - mexPrintf("%s -- Architecture type is \"%s\".\n", - THISFUNCTION,archtyp); - } - imi++; - - if (!mxIsNumeric(prhs[imi])) { - mexPrintf("%s -- Architecture parameter vector must be numeric.\n",THISFUNCTION); - mexErrMsgTxt(" "); - } - else { - napar =mxGetM(prhs[imi])*mxGetN(prhs[imi]); - if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) { - apd=mxGetPr(prhs[imi]); - api = (int *) malloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])*sizeof(int)); - for (i=0; i=0; i--) - free(argvm[i]); - if (api) free(api); - if (archtyp) free(archtyp); - if (ewi) free(ewi); - if (vwi) free(vwi); - if (vli) free(vli); - if (adjjc) free(adjjc); - if (adjir) free(adjir); - - return; -} - -void GmapUsage( void ) -{ - - mexPrintf("\n"); - mexPrintf("Usage: [maptab]=Gmap_mex(adjmat,vertlb,vertwt,edgewt,archtyp,archpar,\n"); - mexPrintf(" Scotch-specific parameters);\n"); - mexPrintf("\n"); - - return; -} - diff --git a/externalpackages/scotch/gmapx.c b/externalpackages/scotch/gmapx.c deleted file mode 100644 index eb5e67178..000000000 --- a/externalpackages/scotch/gmapx.c +++ /dev/null @@ -1,385 +0,0 @@ -/* Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS -** -** This file is part of the Scotch software package for static mapping, -** graph partitioning and sparse matrix ordering. -** -** This software is governed by the CeCILL-C license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-C license and that you accept its terms. -*/ -/************************************************************/ -/** **/ -/** NAME : gmap.c **/ -/** **/ -/** AUTHOR : Francois PELLEGRINI **/ -/** **/ -/** FUNCTION : Part of a graph mapping software. **/ -/** This module contains the main function. **/ -/** **/ -/** DATES : # Version 0.0 : from : 05 jan 1993 **/ -/** to 12 may 1993 **/ -/** # Version 1.1 : from : 15 oct 1993 **/ -/** to 15 oct 1993 **/ -/** # Version 1.3 : from : 06 apr 1994 **/ -/** to 18 may 1994 **/ -/** # Version 2.0 : from : 06 jun 1994 **/ -/** to 17 nov 1994 **/ -/** # Version 2.1 : from : 07 apr 1995 **/ -/** to 18 jun 1995 **/ -/** # Version 3.0 : from : 01 jul 1995 **/ -/** to 02 oct 1995 **/ -/** # Version 3.1 : from : 07 nov 1995 **/ -/** to 25 apr 1996 **/ -/** # Version 3.2 : from : 24 sep 1996 **/ -/** to 26 may 1998 **/ -/** # Version 3.3 : from : 19 oct 1998 **/ -/** to : 30 mar 1999 **/ -/** # Version 3.4 : from : 03 feb 2000 **/ -/** to : 03 feb 2000 **/ -/** # Version 4.0 : from : 16 jan 2004 **/ -/** to : 27 dec 2004 **/ -/** # Version 5.0 : from : 23 dec 2007 **/ -/** to : 18 jun 2008 **/ -/** **/ -/************************************************************/ - -/* -** The defines and includes. -*/ - -#define GMAP - -#include "module.h" -#include "common.h" -#include "scotch.h" -#include "gmap.h" - -/* -** The static variables. -*/ - -static int C_partNbr = 2; /* Default number of parts */ -static int C_paraNum = 0; /* Number of parameters */ -static int C_paraNbr = 0; /* No parameters for mapping */ -static int C_fileNum = 0; /* Number of file in arg list */ -static int C_fileNbr = 4; /* Number of files for mapping */ -static File C_fileTab[C_FILENBR] = { /* File array */ - { "-", NULL, "r" }, - { "-", NULL, "r" }, - { "-", NULL, "w" }, - { "-", NULL, "w" } }; - -static const char * C_usageList[] = { /* Usage */ - "gmap [ [ [ []]]] ", - "gpart [] [ [ []]] ", - " -h : Display this help", - " -m : Set mapping strategy (see user's manual)", - " -s : Force unity weights on :", - " e : edges", - " v : vertices", - " -V : Print program version and copyright", - " -v : Set verbose mode to :", - " m : mapping information", - " s : strategy information", - " t : timing information", - "", - "See default strategy with option '-vs'", - NULL }; - -/******************************/ -/* */ -/* This is the main function. */ -/* */ -/******************************/ - -int -gmapx ( - int (**pmaptabi)[2], - int argcm, - char *argvm[], - int nvi, - int ne2i, - int *ir, - int *jc, - int *vli, - int *vwi, - int *ewi, - char archtyp[], - int nai, - int *api) -{ - SCOTCH_Graph grafdat; /* Source graph */ - SCOTCH_Num grafflag; /* Source graph properties */ - SCOTCH_Arch archdat; /* Target architecture */ - SCOTCH_Strat stradat; /* Mapping strategy */ - SCOTCH_Mapping mapdat; /* Mapping data */ - Clock runtime[2]; /* Timing variables */ - SCOTCH_Num nvert =0; - SCOTCH_Num nedge2=0; - SCOTCH_Num* adjir =NULL; - SCOTCH_Num* adjjc =NULL; - SCOTCH_Num* vertlab=NULL; - SCOTCH_Num* vertwgt=NULL; - SCOTCH_Num* edgewgt=NULL; - SCOTCH_Num napar =0; - SCOTCH_Num* archpar=NULL; - SCOTCH_Num (*maptab)[2]=NULL; - int (*maptabi)[2]=NULL; - int flagval; - int i,j,k; - -/* reset static variables from previous runs (jes, 4/27/10) */ - - C_partNbr = 2; /* Default number of parts */ - C_paraNum = 0; /* Number of parameters */ - C_paraNbr = 0; /* No parameters for mapping */ - C_fileNum = 0; /* Number of file in arg list */ - C_fileNbr = 4; /* Number of files for mapping */ - for (i=0; i= 5) && (strncmp (argvm[0] + i - 5, "gpart", 5) == 0)) { - flagval |= C_FLAGPART; - C_paraNbr = 1; /* One more parameter */ - C_fileNbr = 3; /* One less file to provide */ - errorProg ("gpart"); - } - else - errorProg ("gmap"); - - intRandResetStatic (); - intRandInit (); - - if ((argcm >= 2) && (argvm[1][0] == '?')) { /* If need for help */ - usagePrint (stdout, C_usageList); - return (0); - } - - grafflag = 0; /* Use vertex and edge weights */ - SCOTCH_stratInit (&stradat); /* Set default mapping strategy */ - - for (i = 0; i < C_FILENBR; i ++) /* Set default stream pointers */ - C_fileTab[i].pntr = (C_fileTab[i].mode[0] == 'r') ? stdin : stdout; - for (i = 1; i < argcm; i ++) { /* Loop for all option codes */ - if ((argvm[i][0] != '-') || (argvm[i][1] == '\0') || (argvm[i][1] == '.')) { /* If found a file name */ - if (C_paraNum < C_paraNbr) { /* If number of parameters not reached */ - if ((C_partNbr = atoi (argvm[i])) < 1) /* Get the number of parts */ - errorPrint ("main: invalid number of parts (\"%s\")", argvm[i]); - C_paraNum ++; - continue; /* Process the other parameters */ - } - if (C_fileNum < C_fileNbr) /* A file name has been given */ - C_fileTab[C_fileNum ++].name = argvm[i]; - else - errorPrint ("main: too many file names given"); - } - else { /* If found an option name */ - switch (argvm[i][1]) { - case 'H' : /* Give the usage message */ - case 'h' : - usagePrint (stdout, C_usageList); - return (0); - case 'M' : - case 'm' : - SCOTCH_stratExit (&stradat); - SCOTCH_stratInit (&stradat); - SCOTCH_stratGraphMap (&stradat, &argvm[i][2]); - break; - case 'S' : - case 's' : /* Source graph parameters */ - for (j = 2; argvm[i][j] != '\0'; j ++) { - switch (argvm[i][j]) { - case 'E' : - case 'e' : - grafflag |= 2; /* Do not load edge weights */ - break; - case 'V' : - case 'v' : - grafflag |= 1; /* Do not load vertex weights */ - break; - default : - errorPrint ("main: invalid source graph option (\"%c\")", argvm[i][j]); - } - } - break; - case 'V' : - fprintf (stderr, "gmap/gpart, version %s - F. Pellegrini\n", SCOTCH_VERSION); - fprintf (stderr, "Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS, France\n"); - fprintf (stderr, "This software is libre/free software under CeCILL-C -- see the user's manual for more information\n"); - return (0); - case 'v' : /* Output control info */ - for (j = 2; argvm[i][j] != '\0'; j ++) { - switch (argvm[i][j]) { - case 'M' : - case 'm' : - flagval |= C_FLAGVERBMAP; - break; - case 'S' : - case 's' : - flagval |= C_FLAGVERBSTR; - break; - case 'T' : - case 't' : - flagval |= C_FLAGVERBTIM; - break; - default : - errorPrint ("main: unprocessed parameter \"%c\" in \"%s\"", argvm[i][j], argvm[i]); - } - } - break; - default : - errorPrint ("main: unprocessed option (\"%s\")", argvm[i]); - } - } - } - if ((flagval & C_FLAGPART) != 0) { /* If program run as the partitioner */ - C_fileTab[3].name = C_fileTab[2].name; /* Put provided file names at their right place */ - C_fileTab[2].name = C_fileTab[1].name; - C_fileTab[1].name = "-"; - } - - fileBlockOpen (C_fileTab, C_FILENBR); /* Open all files */ - - clockInit (&runtime[0]); - clockStart (&runtime[0]); - - SCOTCH_graphInit (&grafdat); /* Create graph structure */ - SCOTCH_graphLoad (&grafdat, C_filepntrsrcinp, -1, grafflag, nvert, nedge2, adjir, adjjc, vertlab, vertwgt, edgewgt); /* Read source graph */ - - SCOTCH_archInit (&archdat); /* Create architecture structure */ - if ((flagval & C_FLAGPART) != 0) /* If program run as the partitioner */ - SCOTCH_archCmplt (&archdat, C_partNbr); /* Create a complete graph of proper size */ - else - SCOTCH_archLoad (&archdat, C_filepntrtgtinp, archtyp, napar, archpar); /* Read target architecture */ - - clockStop (&runtime[0]); /* Get input time */ - clockInit (&runtime[1]); - clockStart (&runtime[1]); - - SCOTCH_graphMapInit (&grafdat, &mapdat, &archdat, NULL); - SCOTCH_graphMapCompute (&grafdat, &mapdat, &stradat); /* Perform mapping */ - - clockStop (&runtime[1]); /* Get computation time */ - clockStart (&runtime[0]); - - SCOTCH_graphMapSave (&nvert, &maptab, &grafdat, &mapdat, C_filepntrmapout); /* Write mapping */ - -/* convert output arguments from scotch data types */ - - if (maptab) { - *pmaptabi = (int (*)[2]) malloc(nvert*2*sizeof(int)); - maptabi = *pmaptabi; - for (j=0; j<2; j++) - for (i=0; i : Set mapping strategy (see user's manual)" -% " -s : Force unity weights on :" -% " e : edges" -% " v : vertices" -% " -V : Print program version and copyright" -% " -v : Set verbose mode to :" -% " m : mapping information" -% " s : strategy information" -% " t : timing information" -% "" -% "See default strategy with option '-vs'" -% -function [maptab]=gpart(npart,adj_mat,vlist,vwgt,ewgt,... - varargin) - -if ~nargin - help gpart - return -end - -% gmap_mex uses static variables, so clear those out before every run -clear gmap_mex - -[maptab]=gmap_mex(npart,adj_mat,vlist,vwgt,ewgt,... - varargin{:}); - -% doesn't hurt to clear out after every run, too -clear gmap_mex - -end diff --git a/externalpackages/scotch/install-6.0-linux-parallel-static.sh b/externalpackages/scotch/install-6.0-linux-parallel-static.sh deleted file mode 100644 index d16b1dc68..000000000 --- a/externalpackages/scotch/install-6.0-linux-parallel-static.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -set -eu - - -## NOTE: This install script uses make directly rather than CMake and then make - -## Constants -# -PKG="scotch" -VER="6.0.9" - -# Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/${PKG}_${VER}.tar.gz" "${PKG}_${VER}.tar.gz" - -# Unpack source -tar -zxvf ${PKG}_${VER}.tar.gz - -# Cleanup -rm -rf install src -mkdir install install/include install/lib src - -# Move source to 'src' directory -mv ${PKG}_${VER}/* src -rm -rf ${PKG}_${VER} - -# Copy customized source and config files to 'src' directory -cp configs/6.0/linux/Makefile.inc.linux-parallel-static src/src/Makefile.inc - -# Compile -cd src/src -if [ $# -eq 0 ]; then - make ptscotch - make ptesmumps -else - make -j $1 ptscotch - make -j $1 ptesmumps -fi - -# Install -cd ../.. -cp src/include/* install/include -cp src/lib/lib*.* install/lib diff --git a/externalpackages/scotch/install.sh b/externalpackages/scotch/install.sh deleted file mode 100755 index 03e0138b3..000000000 --- a/externalpackages/scotch/install.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -set -eu - -# Some cleanup -rm -rf scotch_5.1 -rm -rf src -rm -rf install - -# Create src and install directories -mkdir src install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/scotch_5.1.6.tar.gz' 'scotch_5.1.6.tar.gz' -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/docs/ptscotch_user5.1.pdf' 'ptscotch_user5.1.pdf' -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/docs/scotch_user5.1.pdf' 'scotch_user5.1.pdf' - -# Untar -tar -xvzf scotch_5.1.6.tar.gz - -# Apply patches (all at once, since many) -# (written by diff -rc old_src new_src > scotch.patch) -patch -p0 < scotch.patch - -# Move scotch to src directory -mv scotch_5.1/* src -rm -rf scotch_5.1 - -# Build scotch -cp -p Makefile.inc src/src -cp -p gmap_mex.c src/src/scotch -cp -p gmapx.c src/src/scotch -cd src/src -# For stand-alone scotch modules: -make scotch -make clean -# For no-file-io scotch modules: -make nfioscotch -# Clean up -make clean -cd ../.. - -# Populate install directory -cp -pr src/grf install -cp -pr src/tgt install -cp -pr src/doc install -cp -pr src/man install -mkdir install/include -cp -p src/src/libscotch/module.h install/include/scotch_module.h -cp -p src/src/libscotch/common.h install/include/scotch_common.h -cp -p src/include/scotch.h install/include/ -cp -p src/src/scotch/gmap.h install/include/scotch_gmap.h -mkdir install/lib -mv src/lib/* install/lib -mkdir install/bin -mv src/bin/* install/bin -#cp -p gmap.m install/bin -#cp -p gpart.m install/bin diff --git a/externalpackages/scotch/install_macosx64.sh b/externalpackages/scotch/install_macosx64.sh deleted file mode 100755 index a10b76bfa..000000000 --- a/externalpackages/scotch/install_macosx64.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -set -eu - -# Some cleanup -rm -rf scotch_5.1 -rm -rf src -rm -rf install - -# Create src and install directories -mkdir src install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/scotch_5.1.6.tar.gz' 'scotch_5.1.6.tar.gz' -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/docs/ptscotch_user5.1.pdf' 'ptscotch_user5.1.pdf' -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/docs/scotch_user5.1.pdf' 'scotch_user5.1.pdf' - -# Untar -tar -xvzf scotch_5.1.6.tar.gz - -# Apply patches (all at once, since many) -# (written by diff -rc old_src new_src > scotch.patch) -patch -p0 < scotch.patch - -# Move scotch to src directory -mv scotch_5.1/* src -rm -rf scotch_5.1 - -# Build scotch -cp -p Makefile.inc.mac src/src/Makefile.inc -cp -p gmap_mex.c src/src/scotch -cp -p gmapx.c src/src/scotch -cd src/src -# For stand-alone scotch modules: -make scotch -make clean -# For no-file-io scotch modules: -make nfioscotch -# Clean up -make clean -cd ../.. - -# Populate install directory -cp -pr src/grf install -cp -pr src/tgt install -cp -pr src/doc install -cp -pr src/man install -mkdir install/include -cp -p src/src/libscotch/module.h install/include/scotch_module.h -cp -p src/src/libscotch/common.h install/include/scotch_common.h -cp -p src/include/scotch.h install/include/ -cp -p src/src/scotch/gmap.h install/include/scotch_gmap.h -mkdir install/lib -mv src/lib/* install/lib -mkdir install/bin -mv src/bin/* install/bin -#cp -p gmap.m install/bin -#cp -p gpart.m install/bin diff --git a/externalpackages/scotch/mex/Gmap.c b/externalpackages/scotch/mex/Gmap.c deleted file mode 100644 index 4ea866b9f..000000000 --- a/externalpackages/scotch/mex/Gmap.c +++ /dev/null @@ -1,278 +0,0 @@ - -#define THISFUNCTION "Gmap" - -/* Gmap structures and prototypes */ - -#include "mat.h" -#include "mex.h" -#include "matrix.h" - -void GmapUsage( void ); - - -int -Gmapx ( - int (**pmaptabi)[2], - int argcm, - char *argvm[], - int nvi, - int ne2i, - int *ir, - int *jc, - int *vli, - int *vwi, - int *ewi, - char archtyp[], - int nai, - int *api); - -/******************************/ -/* */ -/* This is the main function. */ -/* */ -/******************************/ - -void mexFunction( int nlhs, - mxArray *plhs[], - int nrhs, - const mxArray *prhs[] ) -{ - int argcm; - char **argvm=NULL; - int nvert =0,nedge2=0,napar =0; - mwIndex *ir=NULL,*jc=NULL; - int *adjir=NULL,*adjjc=NULL; - double *vld=NULL,*vwd=NULL,*ewd=NULL,*apd=NULL; - int *vli=NULL,*vwi=NULL,*ewi=NULL,*api=NULL; - char *archtyp=NULL; - int (*maptabi)[2]=NULL; - double* maptabd=NULL; - int i,j,k,imi=0,imo=0,isi=0,ierr; - - /* Check for proper number of arguments */ - - if (nrhs == 0 && nlhs == 0) { - GmapUsage(); - return; - } - else if (nrhs < 6 || nlhs > 1) { - GmapUsage(); - mexErrMsgTxt(" "); - } - -/* load matlab argument list and convert to integer (note that converting here - and in the x-layer is inefficient, but it makes the x-layer more general) */ - - argvm = (char **) calloc(nrhs,sizeof(char *)); - - if (!(mxIsNumeric(prhs[imi]) && - (mxGetM(prhs[imi]) == 1 && mxGetN(prhs[imi]) == 1))) { - argvm[isi] = (char *) calloc(4+1,sizeof(char)); - strcpy(argvm[isi],"Gmap"); - mexPrintf("%s -- Using \"%s\" entry point.\n", - THISFUNCTION,argvm[isi]); - isi++; - } - else { - argvm[isi] = (char *) calloc(5+1,sizeof(char)); - strcpy(argvm[isi],"Gpart"); - mexPrintf("%s -- Using \"%s\" entry point.\n", - THISFUNCTION,argvm[isi]); - isi++; - - argvm[isi] = (char *) calloc(17,sizeof(char)); - sprintf(argvm[isi],"%d",(int)mxGetScalar(prhs[imi])); - mexPrintf("%s -- Number of parts is %s.\n", - THISFUNCTION,argvm[isi]); - isi++; - imi++; - } - - if (!mxIsNumeric(prhs[imi]) || (!mxIsEmpty(prhs[imi]) && !mxIsSparse(prhs[imi]))) { - mexPrintf("%s -- Adjacency matrix must be numeric and sparse.\n",THISFUNCTION); - mexErrMsgTxt(" "); - } - else { - nvert =mxGetM(prhs[imi]); - nedge2=mxGetNzmax(prhs[imi]); - if (mxGetNzmax(prhs[imi])) { - ir =mxGetIr(prhs[imi]); - adjir = (int *) malloc(mxGetNzmax(prhs[imi])*sizeof(int)); - for (i=0; i= 5) && - (strncmp (argvm[0] + strlen (argvm[0]) - 5, "Gpart", 5) == 0))) { - if (!mxIsChar(prhs[imi])) { - mexPrintf("%s -- Architecture type must be character.\n",THISFUNCTION); - mexErrMsgTxt(" "); - } - else { - if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) { - archtyp = (char *) calloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])+1,sizeof(char)); - mxGetString(prhs[imi],archtyp,mxGetM(prhs[imi])*mxGetN(prhs[imi])+1); - } - mexPrintf("%s -- Architecture type is \"%s\".\n", - THISFUNCTION,archtyp); - } - imi++; - - if (!mxIsNumeric(prhs[imi])) { - mexPrintf("%s -- Architecture parameter vector must be numeric.\n",THISFUNCTION); - mexErrMsgTxt(" "); - } - else { - napar =mxGetM(prhs[imi])*mxGetN(prhs[imi]); - if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) { - apd=mxGetPr(prhs[imi]); - api = (int *) malloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])*sizeof(int)); - for (i=0; i=0; i--) - free(argvm[i]); - free(argvm); - } - - return; -} - -void GmapUsage( void ) -{ - - mexPrintf("\n"); - mexPrintf("Usage: [maptab]=Gmap(adjmat,vertlb,vertwt,edgewt,archtyp,archpar,\n"); - mexPrintf(" Scotch-specific parameters);\n"); - mexPrintf("\n"); - - return; -} - diff --git a/externalpackages/scotch/mex/Gmapx.c b/externalpackages/scotch/mex/Gmapx.c deleted file mode 100644 index 818cd3f06..000000000 --- a/externalpackages/scotch/mex/Gmapx.c +++ /dev/null @@ -1,385 +0,0 @@ -/* Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS -** -** This file is part of the Scotch software package for static mapping, -** graph partitioning and sparse matrix ordering. -** -** This software is governed by the CeCILL-C license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-C license and that you accept its terms. -*/ -/************************************************************/ -/** **/ -/** NAME : gmap.c **/ -/** **/ -/** AUTHOR : Francois PELLEGRINI **/ -/** **/ -/** FUNCTION : Part of a graph mapping software. **/ -/** This module contains the main function. **/ -/** **/ -/** DATES : # Version 0.0 : from : 05 jan 1993 **/ -/** to 12 may 1993 **/ -/** # Version 1.1 : from : 15 oct 1993 **/ -/** to 15 oct 1993 **/ -/** # Version 1.3 : from : 06 apr 1994 **/ -/** to 18 may 1994 **/ -/** # Version 2.0 : from : 06 jun 1994 **/ -/** to 17 nov 1994 **/ -/** # Version 2.1 : from : 07 apr 1995 **/ -/** to 18 jun 1995 **/ -/** # Version 3.0 : from : 01 jul 1995 **/ -/** to 02 oct 1995 **/ -/** # Version 3.1 : from : 07 nov 1995 **/ -/** to 25 apr 1996 **/ -/** # Version 3.2 : from : 24 sep 1996 **/ -/** to 26 may 1998 **/ -/** # Version 3.3 : from : 19 oct 1998 **/ -/** to : 30 mar 1999 **/ -/** # Version 3.4 : from : 03 feb 2000 **/ -/** to : 03 feb 2000 **/ -/** # Version 4.0 : from : 16 jan 2004 **/ -/** to : 27 dec 2004 **/ -/** # Version 5.0 : from : 23 dec 2007 **/ -/** to : 18 jun 2008 **/ -/** **/ -/************************************************************/ - -/* -** The defines and includes. -*/ - -#define GMAP - -#include "module.h" -#include "common.h" -#include "scotch.h" -#include "gmap.h" - -/* -** The static variables. -*/ - -static int C_partNbr = 2; /* Default number of parts */ -static int C_paraNum = 0; /* Number of parameters */ -static int C_paraNbr = 0; /* No parameters for mapping */ -static int C_fileNum = 0; /* Number of file in arg list */ -static int C_fileNbr = 4; /* Number of files for mapping */ -static File C_fileTab[C_FILENBR] = { /* File array */ - { "-", NULL, "r" }, - { "-", NULL, "r" }, - { "-", NULL, "w" }, - { "-", NULL, "w" } }; - -static const char * C_usageList[] = { /* Usage */ - "gmap [ [ [ []]]] ", - "gpart [] [ [ []]] ", - " -h : Display this help", - " -m : Set mapping strategy (see user's manual)", - " -s : Force unity weights on :", - " e : edges", - " v : vertices", - " -V : Print program version and copyright", - " -v : Set verbose mode to :", - " m : mapping information", - " s : strategy information", - " t : timing information", - "", - "See default strategy with option '-vs'", - NULL }; - -/******************************/ -/* */ -/* This is the main function. */ -/* */ -/******************************/ - -int -Gmapx ( - int (**pmaptabi)[2], - int argcm, - char *argvm[], - int nvi, - int ne2i, - int *ir, - int *jc, - int *vli, - int *vwi, - int *ewi, - char archtyp[], - int nai, - int *api) -{ - SCOTCH_Graph grafdat; /* Source graph */ - SCOTCH_Num grafflag; /* Source graph properties */ - SCOTCH_Arch archdat; /* Target architecture */ - SCOTCH_Strat stradat; /* Mapping strategy */ - SCOTCH_Mapping mapdat; /* Mapping data */ - Clock runtime[2]; /* Timing variables */ - SCOTCH_Num nvert =0; - SCOTCH_Num nedge2=0; - SCOTCH_Num* adjir =NULL; - SCOTCH_Num* adjjc =NULL; - SCOTCH_Num* vertlab=NULL; - SCOTCH_Num* vertwgt=NULL; - SCOTCH_Num* edgewgt=NULL; - SCOTCH_Num napar =0; - SCOTCH_Num* archpar=NULL; - SCOTCH_Num (*maptab)[2]=NULL; - int (*maptabi)[2]=NULL; - int flagval; - int i,j,k; - -/* reset static variables from previous runs (jes, 4/27/10) */ - - C_partNbr = 2; /* Default number of parts */ - C_paraNum = 0; /* Number of parameters */ - C_paraNbr = 0; /* No parameters for mapping */ - C_fileNum = 0; /* Number of file in arg list */ - C_fileNbr = 4; /* Number of files for mapping */ - for (i=0; i= 5) && (strncmp (argvm[0] + i - 5, "Gpart", 5) == 0)) { - flagval |= C_FLAGPART; - C_paraNbr = 1; /* One more parameter */ - C_fileNbr = 3; /* One less file to provide */ - errorProg ("Gpart"); - } - else - errorProg ("Gmap"); - - intRandResetStatic (); - intRandInit (); - - if ((argcm >= 2) && (argvm[1][0] == '?')) { /* If need for help */ - usagePrint (stdout, C_usageList); - return (0); - } - - grafflag = 0; /* Use vertex and edge weights */ - SCOTCH_stratInit (&stradat); /* Set default mapping strategy */ - - for (i = 0; i < C_FILENBR; i ++) /* Set default stream pointers */ - C_fileTab[i].pntr = (C_fileTab[i].mode[0] == 'r') ? stdin : stdout; - for (i = 1; i < argcm; i ++) { /* Loop for all option codes */ - if ((argvm[i][0] != '-') || (argvm[i][1] == '\0') || (argvm[i][1] == '.')) { /* If found a file name */ - if (C_paraNum < C_paraNbr) { /* If number of parameters not reached */ - if ((C_partNbr = atoi (argvm[i])) < 1) /* Get the number of parts */ - errorPrint ("main: invalid number of parts (\"%s\")", argvm[i]); - C_paraNum ++; - continue; /* Process the other parameters */ - } - if (C_fileNum < C_fileNbr) /* A file name has been given */ - C_fileTab[C_fileNum ++].name = argvm[i]; - else - errorPrint ("main: too many file names given"); - } - else { /* If found an option name */ - switch (argvm[i][1]) { - case 'H' : /* Give the usage message */ - case 'h' : - usagePrint (stdout, C_usageList); - return (0); - case 'M' : - case 'm' : - SCOTCH_stratExit (&stradat); - SCOTCH_stratInit (&stradat); - SCOTCH_stratGraphMap (&stradat, &argvm[i][2]); - break; - case 'S' : - case 's' : /* Source graph parameters */ - for (j = 2; argvm[i][j] != '\0'; j ++) { - switch (argvm[i][j]) { - case 'E' : - case 'e' : - grafflag |= 2; /* Do not load edge weights */ - break; - case 'V' : - case 'v' : - grafflag |= 1; /* Do not load vertex weights */ - break; - default : - errorPrint ("main: invalid source graph option (\"%c\")", argvm[i][j]); - } - } - break; - case 'V' : - fprintf (stderr, "Gmap/Gpart, version %s - F. Pellegrini\n", SCOTCH_VERSION); - fprintf (stderr, "Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS, France\n"); - fprintf (stderr, "This software is libre/free software under CeCILL-C -- see the user's manual for more information\n"); - return (0); - case 'v' : /* Output control info */ - for (j = 2; argvm[i][j] != '\0'; j ++) { - switch (argvm[i][j]) { - case 'M' : - case 'm' : - flagval |= C_FLAGVERBMAP; - break; - case 'S' : - case 's' : - flagval |= C_FLAGVERBSTR; - break; - case 'T' : - case 't' : - flagval |= C_FLAGVERBTIM; - break; - default : - errorPrint ("main: unprocessed parameter \"%c\" in \"%s\"", argvm[i][j], argvm[i]); - } - } - break; - default : - errorPrint ("main: unprocessed option (\"%s\")", argvm[i]); - } - } - } - if ((flagval & C_FLAGPART) != 0) { /* If program run as the partitioner */ - C_fileTab[3].name = C_fileTab[2].name; /* Put provided file names at their right place */ - C_fileTab[2].name = C_fileTab[1].name; - C_fileTab[1].name = "-"; - } - - fileBlockOpen (C_fileTab, C_FILENBR); /* Open all files */ - - clockInit (&runtime[0]); - clockStart (&runtime[0]); - - SCOTCH_graphInit (&grafdat); /* Create graph structure */ - SCOTCH_graphLoad (&grafdat, C_filepntrsrcinp, -1, grafflag, nvert, nedge2, adjir, adjjc, vertlab, vertwgt, edgewgt); /* Read source graph */ - - SCOTCH_archInit (&archdat); /* Create architecture structure */ - if ((flagval & C_FLAGPART) != 0) /* If program run as the partitioner */ - SCOTCH_archCmplt (&archdat, C_partNbr); /* Create a complete graph of proper size */ - else - SCOTCH_archLoad (&archdat, C_filepntrtgtinp, archtyp, napar, archpar); /* Read target architecture */ - - clockStop (&runtime[0]); /* Get input time */ - clockInit (&runtime[1]); - clockStart (&runtime[1]); - - SCOTCH_graphMapInit (&grafdat, &mapdat, &archdat, NULL); - SCOTCH_graphMapCompute (&grafdat, &mapdat, &stradat); /* Perform mapping */ - - clockStop (&runtime[1]); /* Get computation time */ - clockStart (&runtime[0]); - - SCOTCH_graphMapSave (&nvert, &maptab, &grafdat, &mapdat, C_filepntrmapout); /* Write mapping */ - -/* convert output arguments from scotch data types */ - - if (maptab) { - *pmaptabi = (int (*)[2]) malloc(nvert*2*sizeof(int)); - maptabi = *pmaptabi; - for (j=0; j<2; j++) - for (i=0; i -#include /* strcasecmp */ -#include /* clock,time,difftime */ -#include "mex.h" - - -/* Input Arguments */ - -#define IR_IN prhs[0] -#define JC_IN prhs[1] -#define PR_IN prhs[2] -#define M_IN prhs[3] -#define N_IN prhs[4] - -/* Output Arguments */ - -#define A_OUT plhs[0] - - -void VectorToSparseUsage( void ); - - -void mexFunction( int nlhs, - mxArray *plhs[], - int nrhs, - const mxArray *prhs[] ) -{ - int min,nin; - mwIndex *ir =NULL,*jc =NULL; - double *ird=NULL,*jcd=NULL,*pr=NULL,*prd=NULL; - int i,mrow; - - /* Check for proper number of arguments */ - - if (nrhs == 0 && nlhs == 0) { - VectorToSparseUsage(); - return; - } - else if (nrhs < 2 || nlhs != 1) { - VectorToSparseUsage(); - mexErrMsgTxt(" "); - } - - /* Create matrices for the return arguments */ - - if (!mxIsNumeric(IR_IN) || !mxIsNumeric(JC_IN)) { - mexPrintf("%s -- Input matrices IR and JC must be numeric.\n",THISFUNCTION); - mexErrMsgTxt(" "); - } - - mrow = 0; - ird = mxGetPr(IR_IN); - for (i=0; i mrow) - mrow=(int)ird[i]+1; - - if (nrhs >= 4 && mxIsNumeric(M_IN) && !mxIsEmpty(M_IN)) - min = mxGetScalar(M_IN); - else { - min = mrow; - } - - if (mrow > min) { - mexPrintf("%s -- Number of rows specified by M (%d) and IR (%d) is inconsistent.\n", - THISFUNCTION,min,mrow); - mexErrMsgTxt(" "); - } - - if (nrhs >= 5 && mxIsNumeric(N_IN) && !mxIsEmpty(N_IN)) - nin = mxGetScalar(N_IN); - else - nin = mxGetM(JC_IN)*mxGetN(JC_IN)-1; - - if (mxGetM(JC_IN)*mxGetN(JC_IN)-1 != nin) { - mexPrintf("%s -- Number of columns specified by N (%d) and JC (%d) is inconsistent.\n", - THISFUNCTION,nin,mxGetM(JC_IN)*mxGetN(JC_IN)-1); - mexErrMsgTxt(" "); - } - - A_OUT = mxCreateSparse(min, nin, mxGetM(IR_IN)*mxGetN(IR_IN), mxREAL); - if (mxGetM(IR_IN)*mxGetN(IR_IN)) { - ird = mxGetPr(IR_IN); - ir = mxGetIr(A_OUT); - for (i=0; i= 3 && mxIsNumeric(PR_IN) && !mxIsEmpty(PR_IN)) { - if (mxGetM(PR_IN)*mxGetN(PR_IN) != mxGetM(IR_IN)*mxGetN(IR_IN)) { - mexPrintf("%s -- Number of terms specified by IR (%d) and PR (%d) is inconsistent.\n", - THISFUNCTION,mxGetM(IR_IN)*mxGetN(IR_IN),mxGetM(PR_IN)*mxGetN(PR_IN)); - mexErrMsgTxt(" "); - } - - if (mxGetM(PR_IN)*mxGetN(PR_IN)) { - prd = mxGetPr(PR_IN); - pr = mxGetPr(A_OUT); - for (i=0; iarchLoad != NULL) { /* If class has loading function */ -+ #ifndef NOFILEIO - if (class->archLoad (&archptr->data, stream) != 0) { /* Load class data */ -+ #else /* NOFILEIO */ -+ if (class->archLoad (&archptr->data, stream, napar, archpar) != 0) { /* Load class data */ -+ #endif /* NOFILEIO */ - errorPrint ("archLoad: cannot load architecture data"); - memset (archptr, 0, sizeof (Arch)); /* Initialize architecture body */ - return (1); -diff -crB scotch_5.1/src/libscotch/arch_cmplt.c src/src/libscotch/arch_cmplt.c -*** scotch_5.1/src/libscotch/arch_cmplt.c 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_cmplt.c 2013-05-06 14:14:11.000000000 -0700 -*************** -*** 90,99 **** - int - archCmpltArchLoad ( - ArchCmplt * restrict const archptr, -! FILE * restrict const stream) - { - long numnbr; - - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchCmplt) > sizeof (ArchDummy)) || - (sizeof (ArchCmpltDom) > sizeof (ArchDomDummy))) { ---- 90,109 ---- - int - archCmpltArchLoad ( - ArchCmplt * restrict const archptr, -! FILE * restrict const stream -! #ifdef NOFILEIO -! , -! const Anum napar, -! const Anum * archpar -! #endif /* NOFILEIO */ -! ) - { - long numnbr; - -+ #ifdef NOFILEIO -+ // printf("archCmpltArchLoad - napar=%d,archpar=%p\n",napar,archpar); -+ #endif /* NOFILEIO */ -+ - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchCmplt) > sizeof (ArchDummy)) || - (sizeof (ArchCmpltDom) > sizeof (ArchDomDummy))) { -*************** -*** 102,109 **** ---- 112,124 ---- - } - #endif /* SCOTCH_DEBUG_ARCH1 */ - -+ #ifndef NOFILEIO - if ((fscanf (stream, "%ld", &numnbr) != 1) || - (numnbr < 1)) { -+ #else /* NOFILEIO */ -+ if ((napar < 1) || -+ ((numnbr=(long)archpar[0]) < 1)) { -+ #endif /* NOFILEIO */ - errorPrint ("archCmpltArchLoad: bad input"); - return (1); - } -diff -crB scotch_5.1/src/libscotch/arch_cmplt.h src/src/libscotch/arch_cmplt.h -*** scotch_5.1/src/libscotch/arch_cmplt.h 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_cmplt.h 2013-05-06 14:14:11.000000000 -0700 -*************** -*** 87,93 **** ---- 87,97 ---- - #define static - #endif - -+ #ifndef NOFILEIO - int archCmpltArchLoad (ArchCmplt * restrict const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int archCmpltArchLoad (ArchCmplt * restrict const, FILE * restrict const, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archCmpltArchSave (const ArchCmplt * const, FILE * restrict const); - #define archCmpltArchFree NULL - ArchDomNum archCmpltDomNum (const ArchCmplt * const, const ArchCmpltDom * const); -diff -crB scotch_5.1/src/libscotch/arch_cmpltw.c src/src/libscotch/arch_cmpltw.c -*** scotch_5.1/src/libscotch/arch_cmpltw.c 2008-08-27 14:22:22.000000000 -0700 ---- src/src/libscotch/arch_cmpltw.c 2013-05-06 14:14:12.000000000 -0700 -*************** -*** 200,211 **** - int - archCmpltwArchLoad ( - ArchCmpltw * restrict const archptr, -! FILE * restrict const stream) - { - long vertnbr; - Gnum velosum; - Anum vertnum; - - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchCmpltw) > sizeof (ArchDummy)) || - (sizeof (ArchCmpltwDom) > sizeof (ArchDomDummy))) { ---- 200,221 ---- - int - archCmpltwArchLoad ( - ArchCmpltw * restrict const archptr, -! FILE * restrict const stream -! #ifdef NOFILEIO -! , -! const Anum napar, -! const Anum * archpar -! #endif /* NOFILEIO */ -! ) - { - long vertnbr; - Gnum velosum; - Anum vertnum; - -+ #ifdef NOFILEIO -+ // printf("archCmpltwArchLoad - napar=%d,archpar=%p\n",napar,archpar); -+ #endif /* NOFILEIO */ -+ - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchCmpltw) > sizeof (ArchDummy)) || - (sizeof (ArchCmpltwDom) > sizeof (ArchDomDummy))) { -*************** -*** 214,221 **** ---- 224,236 ---- - } - #endif /* SCOTCH_DEBUG_ARCH1 */ - -+ #ifndef NOFILEIO - if ((fscanf (stream, "%ld", &vertnbr) != 1) || - (vertnbr < 1)) { -+ #else /* NOFILEIO */ -+ if ((napar < 1) || -+ ((vertnbr=(long)archpar[0]) < 1)) { -+ #endif /* NOFILEIO */ - errorPrint ("archCmpltwArchLoad: bad input (1)"); - return (1); - } -*************** -*** 230,237 **** ---- 245,257 ---- - long veloval; - Gnum velotmp; - -+ #ifndef NOFILEIO - if ((fscanf (stream, "%ld", &veloval) != 1) || - (veloval < 1)) { -+ #else /* NOFILEIO */ -+ if ((napar < 1+(vertnum+1)) || -+ ((veloval=(long)archpar[1+(vertnum+1)]) < 1)) { -+ #endif /* NOFILEIO */ - errorPrint ("archCmpltwArchLoad: bad input (2)"); - return (1); - } -diff -crB scotch_5.1/src/libscotch/arch_cmpltw.h src/src/libscotch/arch_cmpltw.h -*** scotch_5.1/src/libscotch/arch_cmpltw.h 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_cmpltw.h 2013-05-06 14:14:12.000000000 -0700 -*************** -*** 86,92 **** ---- 86,96 ---- - #endif - - int archCmpltwArchBuild (ArchCmpltw * restrict const archptr, const Gnum, const Gnum * restrict const); -+ #ifndef NOFILEIO - int archCmpltwArchLoad (ArchCmpltw * restrict const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int archCmpltwArchLoad (ArchCmpltw * restrict const, FILE * restrict const, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archCmpltwArchSave (const ArchCmpltw * const, FILE * restrict const); - int archCmpltwArchFree (ArchCmpltw * restrict const); - ArchDomNum archCmpltwDomNum (const ArchCmpltw * const, const ArchCmpltwDom * const); -diff -crB scotch_5.1/src/libscotch/arch_deco.c src/src/libscotch/arch_deco.c -*** scotch_5.1/src/libscotch/arch_deco.c 2008-09-28 06:35:27.000000000 -0700 ---- src/src/libscotch/arch_deco.c 2013-05-06 14:14:12.000000000 -0700 -*************** -*** 211,217 **** - int - archDecoArchLoad ( - ArchDeco * restrict const archptr, -! FILE * restrict const stream) - { - INT decotype; /* Type of decomposition */ - INT termdomnbr; /* Number of terminal domains (ie processors) */ ---- 211,223 ---- - int - archDecoArchLoad ( - ArchDeco * restrict const archptr, -! FILE * restrict const stream -! #ifdef NOFILEIO -! , -! const Anum napar, -! const Anum * archpar -! #endif /* NOFILEIO */ -! ) - { - INT decotype; /* Type of decomposition */ - INT termdomnbr; /* Number of terminal domains (ie processors) */ -*************** -*** 220,225 **** ---- 226,237 ---- - Anum * restrict termdisttab; /* Table of terminal-to-terminal distances */ - INT i, j; - -+ #ifdef NOFILEIO -+ // printf("archDecoArchLoad - napar=%d,archpar=%p\n",napar,archpar); -+ errorPrint ("archDecoArchLoad - not yet converted to matlab matrices"); -+ return (1); -+ #endif /* NOFILEIO */ -+ - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchDeco) > sizeof (ArchDummy)) || - (sizeof (ArchDecoDom) > sizeof (ArchDomDummy))) { -diff -crB scotch_5.1/src/libscotch/arch_deco.h src/src/libscotch/arch_deco.h -*** scotch_5.1/src/libscotch/arch_deco.h 2008-09-27 07:49:46.000000000 -0700 ---- src/src/libscotch/arch_deco.h 2013-05-06 14:14:13.000000000 -0700 -*************** -*** 113,119 **** ---- 113,123 ---- - #endif - - int archDecoArchBuild (ArchDeco * const, const Anum, const Anum, const ArchDecoTermVert * const, const Anum * const); -+ #ifndef NOFILEIO - int archDecoArchLoad (ArchDeco * const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int archDecoArchLoad (ArchDeco * const, FILE * restrict const, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archDecoArchSave (const ArchDeco * const, FILE * restrict const); - int archDecoArchFree (ArchDeco * const); - Anum archDecoArchSize (ArchDeco * const, const Anum); -diff -crB scotch_5.1/src/libscotch/arch.h src/src/libscotch/arch.h -*** scotch_5.1/src/libscotch/arch.h 2009-04-28 08:11:27.000000000 -0700 ---- src/src/libscotch/arch.h 2013-05-06 14:14:13.000000000 -0700 -*************** -*** 175,181 **** ---- 175,185 ---- - int archInit (Arch * restrict const); - int archExit (Arch * restrict const); - int archFree (Arch * restrict const); -+ #ifndef NOFILEIO - int archLoad (Arch * restrict const, FILE * const); -+ #else /* NOFILEIO */ -+ int archLoad (Arch * restrict const, FILE * const, const char *, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archSave (const Arch * const, FILE * const); - char * archName (const Arch * const); - const ArchClass * archClass (const char * const); -diff -crB scotch_5.1/src/libscotch/arch_hcub.c src/src/libscotch/arch_hcub.c -*** scotch_5.1/src/libscotch/arch_hcub.c 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_hcub.c 2013-05-06 14:14:13.000000000 -0700 -*************** -*** 88,95 **** - int - archHcubArchLoad ( - ArchHcub * restrict const archptr, -! FILE * restrict const stream) - { - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchHcub) > sizeof (ArchDummy)) || - (sizeof (ArchHcubDom) > sizeof (ArchDomDummy))) { ---- 88,105 ---- - int - archHcubArchLoad ( - ArchHcub * restrict const archptr, -! FILE * restrict const stream -! #ifdef NOFILEIO -! , -! const Anum napar, -! const Anum * archpar -! #endif /* NOFILEIO */ -! ) - { -+ #ifdef NOFILEIO -+ // printf("archHcubArchLoad - napar=%d,archpar=%p\n",napar,archpar); -+ #endif /* NOFILEIO */ -+ - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchHcub) > sizeof (ArchDummy)) || - (sizeof (ArchHcubDom) > sizeof (ArchDomDummy))) { -*************** -*** 98,105 **** ---- 108,120 ---- - } - #endif /* SCOTCH_DEBUG_ARCH1 */ - -+ #ifndef NOFILEIO - if ((intLoad (stream, &archptr->dimmax) != 1) || - (archptr->dimmax < 1) || -+ #else /* NOFILEIO */ -+ if ((napar < 1) || -+ ((archptr->dimmax=archpar[0]) < 1) || -+ #endif /* NOFILEIO */ - (archptr->dimmax > (sizeof (archptr->dimmax) << 3))) { - errorPrint ("archHcubArchLoad: bad input"); - return (1); -diff -crB scotch_5.1/src/libscotch/arch_hcub.h src/src/libscotch/arch_hcub.h -*** scotch_5.1/src/libscotch/arch_hcub.h 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_hcub.h 2013-05-06 14:14:14.000000000 -0700 -*************** -*** 85,91 **** ---- 85,95 ---- - #define static - #endif - -+ #ifndef NOFILEIO - int archHcubArchLoad (ArchHcub * restrict const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int archHcubArchLoad (ArchHcub * restrict const, FILE * restrict const, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archHcubArchSave (const ArchHcub * const, FILE * restrict const); - #define archHcubArchFree NULL - ArchDomNum archHcubDomNum (const ArchHcub * const, const ArchHcubDom * const); -diff -crB scotch_5.1/src/libscotch/arch_mesh.c src/src/libscotch/arch_mesh.c -*** scotch_5.1/src/libscotch/arch_mesh.c 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_mesh.c 2013-05-06 14:14:14.000000000 -0700 -*************** -*** 96,103 **** - int - archMesh2ArchLoad ( - ArchMesh2 * restrict const archptr, -! FILE * restrict const stream) -! { - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchMesh2) > sizeof (ArchDummy)) || - (sizeof (ArchMesh2Dom) > sizeof (ArchDomDummy))) { ---- 96,113 ---- - int - archMesh2ArchLoad ( - ArchMesh2 * restrict const archptr, -! FILE * restrict const stream -! #ifdef NOFILEIO -! , -! const Anum napar, -! const Anum * archpar -! #endif /* NOFILEIO */ -! ) -! { -! #ifdef NOFILEIO -! // printf("archMesh2ArchLoad - napar=%d,archpar=%p\n",napar,archpar); -! #endif /* NOFILEIO */ -! - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchMesh2) > sizeof (ArchDummy)) || - (sizeof (ArchMesh2Dom) > sizeof (ArchDomDummy))) { -*************** -*** 106,114 **** ---- 116,130 ---- - } - #endif /* SCOTCH_DEBUG_ARCH1 */ - -+ #ifndef NOFILEIO - if ((intLoad (stream, &archptr->c[0]) != 1) || - (intLoad (stream, &archptr->c[1]) != 1) || - (archptr->c[0] < 1) || (archptr->c[1] < 1)) { -+ #else /* NOFILEIO */ -+ if ((napar < 2) || -+ ((archptr->c[0]=archpar[0]) < 1) || -+ ((archptr->c[1]=archpar[1]) < 1)) { -+ #endif /* NOFILEIO */ - errorPrint ("archMesh2ArchLoad: bad input"); - return (1); - } -*************** -*** 421,428 **** - int - archMesh3ArchLoad ( - ArchMesh3 * restrict const archptr, -! FILE * restrict const stream) -! { - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchMesh3) > sizeof (ArchDummy)) || - (sizeof (ArchMesh3Dom) > sizeof (ArchDomDummy))) { ---- 437,454 ---- - int - archMesh3ArchLoad ( - ArchMesh3 * restrict const archptr, -! FILE * restrict const stream -! #ifdef NOFILEIO -! , -! const Anum napar, -! const Anum * archpar -! #endif /* NOFILEIO */ -! ) -! { -! #ifdef NOFILEIO -! // printf("archMesh3ArchLoad - napar=%d,archpar=%p\n",napar,archpar); -! #endif /* NOFILEIO */ -! - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchMesh3) > sizeof (ArchDummy)) || - (sizeof (ArchMesh3Dom) > sizeof (ArchDomDummy))) { -*************** -*** 431,440 **** ---- 457,473 ---- - } - #endif /* SCOTCH_DEBUG_ARCH1 */ - -+ #ifndef NOFILEIO - if ((intLoad (stream, &archptr->c[0]) != 1) || - (intLoad (stream, &archptr->c[1]) != 1) || - (intLoad (stream, &archptr->c[2]) != 1) || - (archptr->c[0] < 1) || (archptr->c[1] < 1) || (archptr->c[2] < 1)) { -+ #else /* NOFILEIO */ -+ if ((napar < 3) || -+ ((archptr->c[0]=archpar[0]) < 1) || -+ ((archptr->c[1]=archpar[1]) < 1) || -+ ((archptr->c[2]=archpar[2]) < 1)) { -+ #endif /* NOFILEIO */ - errorPrint ("archMesh3ArchLoad: bad input"); - return (1); - } -diff -crB scotch_5.1/src/libscotch/arch_mesh.h src/src/libscotch/arch_mesh.h -*** scotch_5.1/src/libscotch/arch_mesh.h 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_mesh.h 2013-05-06 14:14:14.000000000 -0700 -*************** -*** 96,102 **** ---- 96,106 ---- - #define static - #endif - -+ #ifndef NOFILEIO - int archMesh2ArchLoad (ArchMesh2 * restrict const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int archMesh2ArchLoad (ArchMesh2 * restrict const, FILE * restrict const, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archMesh2ArchSave (const ArchMesh2 * const, FILE * restrict const); - #define archMesh2ArchFree NULL - ArchDomNum archMesh2DomNum (const ArchMesh2 * const, const ArchMesh2Dom * const); -*************** -*** 114,120 **** ---- 118,128 ---- - int archMesh2DomMpiType (const ArchMesh2 * const, MPI_Datatype * const); - #endif /* SCOTCH_PTSCOTCH */ - -+ #ifndef NOFILEIO - int archMesh3ArchLoad (ArchMesh3 * restrict const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int archMesh3ArchLoad (ArchMesh3 * restrict const, FILE * restrict const, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archMesh3ArchSave (const ArchMesh3 * const, FILE * restrict const); - #define archMesh3ArchFree NULL - ArchDomNum archMesh3DomNum (const ArchMesh3 * const, const ArchMesh3Dom * const); -diff -crB scotch_5.1/src/libscotch/arch_tleaf.c src/src/libscotch/arch_tleaf.c -*** scotch_5.1/src/libscotch/arch_tleaf.c 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_tleaf.c 2013-05-06 14:14:14.000000000 -0700 -*************** -*** 92,99 **** - int - archTleafArchLoad ( - ArchTleaf * restrict const archptr, -! FILE * restrict const stream) - { - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchTleaf) > sizeof (ArchDummy)) || - (sizeof (ArchTleafDom) > sizeof (ArchDomDummy))) { ---- 92,109 ---- - int - archTleafArchLoad ( - ArchTleaf * restrict const archptr, -! FILE * restrict const stream -! #ifdef NOFILEIO -! , -! const Anum napar, -! const Anum * archpar -! #endif /* NOFILEIO */ -! ) - { -+ #ifdef NOFILEIO -+ // printf("archTleafArchLoad - napar=%d,archpar=%p\n",napar,archpar); -+ #endif /* NOFILEIO */ -+ - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchTleaf) > sizeof (ArchDummy)) || - (sizeof (ArchTleafDom) > sizeof (ArchDomDummy))) { -*************** -*** 102,107 **** ---- 112,118 ---- - } - #endif /* SCOTCH_DEBUG_ARCH1 */ - -+ #ifndef NOFILEIO - if ((intLoad (stream, &archptr->leafdep) != 1) || - (intLoad (stream, &archptr->clusdep) != 1) || - (intLoad (stream, &archptr->linkval) != 1) || -*************** -*** 109,114 **** ---- 120,132 ---- - (archptr->clusdep < 0) || - (archptr->clusdep > archptr->leafdep) || - (archptr->linkval < 1)) { -+ #else /* NOFILEIO */ -+ if ((napar < 3) || -+ ((archptr->leafdep=archpar[0]) < 1) || -+ ((archptr->clusdep=archpar[1]) < 0) || -+ ( archptr->clusdep > archptr->leafdep) || -+ ((archptr->linkval=archpar[2]) < 1)) { -+ #endif /* NOFILEIO */ - errorPrint ("archTleafArchLoad: bad input"); - return (1); - } -diff -crB scotch_5.1/src/libscotch/arch_tleaf.h src/src/libscotch/arch_tleaf.h -*** scotch_5.1/src/libscotch/arch_tleaf.h 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_tleaf.h 2013-05-06 14:14:15.000000000 -0700 -*************** -*** 89,95 **** ---- 89,99 ---- - #define static - #endif - -+ #ifndef NOFILEIO - int archTleafArchLoad (ArchTleaf * restrict const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int archTleafArchLoad (ArchTleaf * restrict const, FILE * restrict const, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archTleafArchSave (const ArchTleaf * const, FILE * restrict const); - #define archTleafArchFree NULL - ArchDomNum archTleafDomNum (const ArchTleaf * const, const ArchTleafDom * const); -diff -crB scotch_5.1/src/libscotch/arch_torus.c src/src/libscotch/arch_torus.c -*** scotch_5.1/src/libscotch/arch_torus.c 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_torus.c 2013-05-06 14:14:15.000000000 -0700 -*************** -*** 90,97 **** - int - archTorus2ArchLoad ( - ArchTorus2 * restrict const archptr, -! FILE * restrict const stream) -! { - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchTorus2) > sizeof (ArchDummy)) || - (sizeof (ArchTorus2Dom) > sizeof (ArchDomDummy))) { ---- 90,107 ---- - int - archTorus2ArchLoad ( - ArchTorus2 * restrict const archptr, -! FILE * restrict const stream -! #ifdef NOFILEIO -! , -! const Anum napar, -! const Anum * archpar -! #endif /* NOFILEIO */ -! ) -! { -! #ifdef NOFILEIO -! // printf("archTorus2ArchLoad - napar=%d,archpar=%p\n",napar,archpar); -! #endif /* NOFILEIO */ -! - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchTorus2) > sizeof (ArchDummy)) || - (sizeof (ArchTorus2Dom) > sizeof (ArchDomDummy))) { -*************** -*** 100,108 **** ---- 110,124 ---- - } - #endif /* SCOTCH_DEBUG_ARCH1 */ - -+ #ifndef NOFILEIO - if ((intLoad (stream, &archptr->c[0]) != 1) || - (intLoad (stream, &archptr->c[1]) != 1) || - (archptr->c[0] < 1) || (archptr->c[1] < 1)) { -+ #else /* NOFILEIO */ -+ if ((napar < 2) || -+ ((archptr->c[0]=archpar[0]) < 1) || -+ ((archptr->c[1]=archpar[1]) < 1)) { -+ #endif /* NOFILEIO */ - errorPrint ("archTorus2ArchLoad: bad input"); - return (1); - } -*************** -*** 363,370 **** - int - archTorus3ArchLoad ( - ArchTorus3 * restrict const archptr, -! FILE * restrict const stream) -! { - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchTorus3) > sizeof (ArchDummy)) || - (sizeof (ArchTorus3Dom) > sizeof (ArchDomDummy))) { ---- 379,396 ---- - int - archTorus3ArchLoad ( - ArchTorus3 * restrict const archptr, -! FILE * restrict const stream -! #ifdef NOFILEIO -! , -! const Anum napar, -! const Anum * archpar -! #endif /* NOFILEIO */ -! ) -! { -! #ifdef NOFILEIO -! // printf("archTorus3ArchLoad - napar=%d,archpar=%p\n",napar,archpar); -! #endif /* NOFILEIO */ -! - #ifdef SCOTCH_DEBUG_ARCH1 - if ((sizeof (ArchTorus3) > sizeof (ArchDummy)) || - (sizeof (ArchTorus3Dom) > sizeof (ArchDomDummy))) { -*************** -*** 373,382 **** ---- 399,415 ---- - } - #endif /* SCOTCH_DEBUG_ARCH1 */ - -+ #ifndef NOFILEIO - if ((intLoad (stream, &archptr->c[0]) != 1) || - (intLoad (stream, &archptr->c[1]) != 1) || - (intLoad (stream, &archptr->c[2]) != 1) || - (archptr->c[0] < 1) || (archptr->c[1] < 1) || (archptr->c[2] < 1)) { -+ #else /* NOFILEIO */ -+ if ((napar < 3) || -+ ((archptr->c[0]=archpar[0]) < 1) || -+ ((archptr->c[1]=archpar[1]) < 1) || -+ ((archptr->c[2]=archpar[2]) < 1)) { -+ #endif /* NOFILEIO */ - errorPrint ("archTorus3ArchLoad: bad input"); - return (1); - } -diff -crB scotch_5.1/src/libscotch/arch_torus.h src/src/libscotch/arch_torus.h -*** scotch_5.1/src/libscotch/arch_torus.h 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/arch_torus.h 2013-05-06 14:14:15.000000000 -0700 -*************** -*** 96,102 **** ---- 96,106 ---- - #define static - #endif - -+ #ifndef NOFILEIO - int archTorus2ArchLoad (ArchTorus2 * restrict const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int archTorus2ArchLoad (ArchTorus2 * restrict const, FILE * restrict const, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archTorus2ArchSave (const ArchTorus2 * const, FILE * restrict const); - #define archTorus2ArchFree NULL - ArchDomNum archTorus2DomNum (const ArchTorus2 * const, const ArchTorus2Dom * const); -*************** -*** 114,120 **** ---- 118,128 ---- - int archTorus2DomMpiType (const ArchTorus2 * const, MPI_Datatype * const); - #endif /* SCOTCH_PTSCOTCH */ - -+ #ifndef NOFILEIO - int archTorus3ArchLoad (ArchTorus3 * restrict const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int archTorus3ArchLoad (ArchTorus3 * restrict const, FILE * restrict const, const Anum, const Anum *); -+ #endif /* NOFILEIO */ - int archTorus3ArchSave (const ArchTorus3 * const, FILE * restrict const); - #define archTorus3ArchFree NULL - ArchDomNum archTorus3DomNum (const ArchTorus3 * const, const ArchTorus3Dom * const); -diff -crB scotch_5.1/src/libscotch/common.c src/src/libscotch/common.c -*** scotch_5.1/src/libscotch/common.c 2008-05-22 06:44:41.000000000 -0700 ---- src/src/libscotch/common.c 2013-05-06 14:14:15.000000000 -0700 -*************** -*** 100,106 **** ---- 100,112 ---- - { - const char ** cptr; - -+ #ifndef MATLAB - fprintf (stream, "Usage is:\n"); - for (cptr = data; *cptr != NULL; cptr ++) - fprintf (stream, " %s\n", *cptr); -+ #else /* MATLAB */ -+ mexPrintf ("Usage is:\n"); -+ for (cptr = data; *cptr != NULL; cptr ++) -+ mexPrintf (" %s\n", *cptr); -+ #endif /* MATLAB */ - } -diff -crB scotch_5.1/src/libscotch/common.h src/src/libscotch/common.h -*** scotch_5.1/src/libscotch/common.h 2009-02-06 14:20:55.000000000 -0800 ---- src/src/libscotch/common.h 2013-05-09 11:49:35.317220518 -0700 -*************** -*** 1,3 **** ---- 1,5 ---- -+ #ifndef _SCOTCH_COMMON_H_ -+ #define _SCOTCH_COMMON_H_ - /* Copyright 2004,2007-2009 ENSEIRB, INRIA & CNRS - ** - ** This file is part of the Scotch software package for static mapping, -*************** -*** 79,84 **** ---- 81,87 ---- - #include - #endif /* COMMON_TIMING_OLD */ - #include -+ #include - - #ifdef SCOTCH_PTSCOTCH - #include -*************** -*** 106,113 **** - #define memCpy(dst,src,siz) memcpy((dst),(src),(siz)) - #define memMov(dst,src,siz) memmove((dst),(src),(siz)) - -- #define MIN(x,y) (((x) < (y)) ? (x) : (y)) -- #define MAX(x,y) (((x) < (y)) ? (y) : (x)) - #define ABS(x) MAX ((x), -(x)) - #define SIGN(x) (((x) < 0) ? -1 : 1) - ---- 109,114 ---- -*************** -*** 171,179 **** - /** The file structure. **/ - - typedef struct File_ { -! char * name; /*+ File name +*/ - FILE * pntr; /*+ File pointer +*/ -! char * mode; /*+ Opening mode +*/ - } File; - - /* ---- 172,180 ---- - /** The file structure. **/ - - typedef struct File_ { -! const char * name; /*+ File name +*/ - FILE * pntr; /*+ File pointer +*/ -! const char * mode; /*+ Opening mode +*/ - } File; - - /* -*************** -*** 190,216 **** - size_t memMax (); - #endif /* COMMON_MEMORY_TRACE */ - -- void usagePrint (FILE * const, const char (* [])); - -- int fileBlockOpen (File * const, const int); - int fileBlockOpenDist (File * const, const int, const int, const int, const int); -- void fileBlockClose (File * const, const int); - FILE * fileCompress (FILE * const, const int); - int fileCompressType (const char * const); - FILE * fileUncompress (FILE * const, const int); - int fileUncompressType (const char * const); - int fileNameDistExpand (char ** const, const int, const int, const int); - - void errorProg (const char * const); - void errorPrint (const char * const, ...); - void errorPrintW (const char * const, ...); - - int intLoad (FILE * const, INT * const); - int intSave (FILE * const, const INT); - void intAscn (INT * const, const INT, const INT); - void intPerm (INT * const, const INT); - void intRandReset (void); -- void intRandInit (void); - INT intRandVal (INT); - void intSort1asc1 (void * const, const INT); - void intSort2asc1 (void * const, const INT); ---- 191,227 ---- - size_t memMax (); - #endif /* COMMON_MEMORY_TRACE */ - - - int fileBlockOpenDist (File * const, const int, const int, const int, const int); - FILE * fileCompress (FILE * const, const int); - int fileCompressType (const char * const); - FILE * fileUncompress (FILE * const, const int); - int fileUncompressType (const char * const); - int fileNameDistExpand (char ** const, const int, const int, const int); - -+ #ifdef __cplusplus -+ extern "C" { -+ #endif /* __cplusplus */ -+ - void errorProg (const char * const); - void errorPrint (const char * const, ...); - void errorPrintW (const char * const, ...); -+ double clockGet (void); -+ void usagePrint (FILE * const, const char (* [])); -+ void intRandInit (void); -+ int fileBlockOpen (File * const, const int); -+ void fileBlockClose (File * const, const int); -+ void intRandResetStatic (void); -+ -+ #ifdef __cplusplus -+ } -+ #endif /* __cplusplus */ - - int intLoad (FILE * const, INT * const); - int intSave (FILE * const, const INT); - void intAscn (INT * const, const INT, const INT); - void intPerm (INT * const, const INT); - void intRandReset (void); - INT intRandVal (INT); - void intSort1asc1 (void * const, const INT); - void intSort2asc1 (void * const, const INT); -*************** -*** 221,227 **** - void clockStart (Clock * const); - void clockStop (Clock * const); - double clockVal (Clock * const); -- double clockGet (void); - - /* - ** Macro definitions. ---- 232,237 ---- -*************** -*** 249,251 **** ---- 259,263 ---- - void nl##__ pl \ - { nu pc; } \ - void nu pl -+ -+ #endif //#ifndef _SCOTCH_COMMON_H_ -diff -crB scotch_5.1/src/libscotch/common_integer.c src/src/libscotch/common_integer.c -*** scotch_5.1/src/libscotch/common_integer.c 2009-01-21 01:32:32.000000000 -0800 ---- src/src/libscotch/common_integer.c 2013-05-06 14:14:16.000000000 -0700 -*************** -*** 191,196 **** ---- 191,209 ---- - static volatile int intrandflag = 0; /*+ Flag set if generator already initialized +*/ - static unsigned int intrandseed = 1; /*+ Random seed +*/ - -+ void -+ intRandResetStatic (void) -+ { -+ #ifdef MATLAB -+ // printf("intRandResetStatic begin - intrandflag=%d,intrandseed=%d\n",intrandflag,intrandseed); -+ #endif /* MATLAB */ -+ intrandflag = 0; /*+ Flag set if generator already initialized +*/ -+ intrandseed = 1; /*+ Random seed +*/ -+ #ifdef MATLAB -+ // printf("intRandResetStatic end - intrandflag=%d,intrandseed=%d\n",intrandflag,intrandseed); -+ #endif /* MATLAB */ -+ } -+ - /* This routine initializes the pseudo-random - ** generator if necessary. In order for multi-sequential - ** programs to have exactly the same behavior on any -*************** -*** 205,210 **** ---- 218,226 ---- - void - intRandInit (void) - { -+ #ifdef MATLAB -+ // printf("intRandInit begin - intrandflag=%d,intrandseed=%d\n",intrandflag,intrandseed); -+ #endif /* MATLAB */ - if (intrandflag == 0) { /* If generator not yet initialized */ - #if ! ((defined COMMON_DEBUG) || (defined COMMON_RANDOM_FIXED_SEED) || (defined SCOTCH_DETERMINISTIC)) - intrandseed = time (NULL); /* Set random seed if needed */ -*************** -*** 216,221 **** ---- 232,240 ---- - #endif /* COMMON_RANDOM_RAND */ - intrandflag = 1; /* Generator has been initialized */ - } -+ #ifdef MATLAB -+ // printf("intRandInit end - intrandflag=%d,intrandseed=%d\n",intrandflag,intrandseed); -+ #endif /* MATLAB */ - } - - /* This routine reinitializes the pseudo-random -*************** -*** 228,233 **** ---- 247,255 ---- - void - intRandReset (void) - { -+ #ifdef MATLAB -+ // printf("intRandReset begin - intrandflag=%d,intrandseed=%d\n",intrandflag,intrandseed); -+ #endif /* MATLAB */ - if (intrandflag != 0) { /* Keep seed computed during first initialization */ - #ifdef COMMON_RANDOM_RAND - srand (intrandseed); -*************** -*** 237,242 **** ---- 259,267 ---- - } - else - intRandInit (); -+ #ifdef MATLAB -+ // printf("intRandReset end - intrandflag=%d,intrandseed=%d\n",intrandflag,intrandseed); -+ #endif /* MATLAB */ - } - - /*********************/ -diff -crB scotch_5.1/src/libscotch/common_memory.c src/src/libscotch/common_memory.c -*** scotch_5.1/src/libscotch/common_memory.c 2009-01-03 02:16:11.000000000 -0800 ---- src/src/libscotch/common_memory.c 2013-05-06 14:14:16.000000000 -0700 -*************** -*** 87,93 **** ---- 87,95 ---- - size_t newadd; - byte * newptr; - -+ printf("memAllocRecord begin -- memorysiz=%d,memorymax=%d\n",memorysiz,memorymax); - #if (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) -+ printf("memAllocRecord begin -- muteflag=%d,mutelocdat=%p\n",muteflag,mutelocdat); - if (muteflag != 0) { /* Unsafe code with respect to race conditions but should work as first allocs are sequential */ - muteflag = 0; - pthread_mutex_init (&mutelocdat, NULL); /* Initialize local mutex */ -*************** -*** 109,116 **** ---- 111,120 ---- - - #if (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) - pthread_mutex_unlock (&mutelocdat); /* Unlock local mutex */ -+ printf("memAllocRecord end -- muteflag=%d,mutelocdat=%p\n",muteflag,mutelocdat); - #endif /* (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) */ - -+ printf("memAllocRecord end -- memorysiz=%d,memorymax=%d\n",memorysiz,memorymax); - return ((void *) newptr); /* Return skewed pointer or NULL */ - } - -*************** -*** 124,133 **** ---- 128,139 ---- - size_t oldsiz; - size_t newadd; - -+ printf("memReallocRecord begin -- memorysiz=%d,memorymax=%d\n",memorysiz,memorymax); - tmpptr = ((byte *) oldptr) - COMMON_MEMORY_SKEW; - oldsiz = *((size_t *) tmpptr); - - #if (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) -+ printf("memReallocRecord begin -- muteflag=%d,mutelocdat=%p\n",muteflag,mutelocdat); - pthread_mutex_lock (&mutelocdat); /* Lock local mutex */ - #endif /* (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) */ - -*************** -*** 145,152 **** ---- 151,160 ---- - - #if (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) - pthread_mutex_unlock (&mutelocdat); /* Unlock local mutex */ -+ printf("memReallocRecord end -- muteflag=%d,mutelocdat=%p\n",muteflag,mutelocdat); - #endif /* (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) */ - -+ printf("memReallocRecord end -- memorysiz=%d,memorymax=%d\n",memorysiz,memorymax); - return ((void *) newptr); /* Return skewed pointer or NULL */ - } - -*************** -*** 157,166 **** ---- 165,176 ---- - byte * tmpptr; - size_t oldsiz; - -+ printf("memFreeRecord begin -- memorysiz=%d,memorymax=%d\n",memorysiz,memorymax); - tmpptr = ((byte *) oldptr) - COMMON_MEMORY_SKEW; - oldsiz = *((size_t *) tmpptr); - - #if (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) -+ printf("memFreeRecord begin -- muteflag=%d,mutelocdat=%p\n",muteflag,mutelocdat); - pthread_mutex_lock (&mutelocdat); /* Lock local mutex */ - #endif /* (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) */ - -*************** -*** 169,175 **** ---- 179,187 ---- - - #if (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) - pthread_mutex_unlock (&mutelocdat); /* Unlock local mutex */ -+ printf("memFreeRecord end -- muteflag=%d,mutelocdat=%p\n",muteflag,mutelocdat); - #endif /* (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) */ -+ printf("memFreeRecord end -- memorysiz=%d,memorymax=%d\n",memorysiz,memorymax); - } - - size_t -*************** -*** 177,183 **** ---- 189,197 ---- - { - size_t curmax; - -+ printf("memMax begin -- memorysiz=%d,memorymax=%d\n",memorysiz,memorymax); - #if (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) -+ printf("memMax begin -- muteflag=%d,mutelocdat=%p\n",muteflag,mutelocdat); - pthread_mutex_lock (&mutelocdat); /* Lock local mutex */ - #endif /* (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) */ - -*************** -*** 185,192 **** ---- 199,208 ---- - - #if (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) - pthread_mutex_unlock (&mutelocdat); /* Unlock local mutex */ -+ printf("memMax end -- muteflag=%d,mutelocdat=%p\n",muteflag,mutelocdat); - #endif /* (defined (COMMON_PTHREAD) || defined (SCOTCH_PTHREAD)) */ - -+ printf("memMax end -- memorysiz=%d,memorymax=%d\n",memorysiz,memorymax); - return (curmax); - } - #endif /* COMMON_MEMORY_TRACE */ -diff -crB scotch_5.1/src/libscotch/dummysizes.c src/src/libscotch/dummysizes.c -*** scotch_5.1/src/libscotch/dummysizes.c 2009-05-09 16:08:02.000000000 -0700 ---- src/src/libscotch/dummysizes.c 2013-05-06 14:14:16.000000000 -0700 -*************** -*** 267,271 **** ---- 267,273 ---- - } - #endif /* SCOTCH_DEBUG_MAIN1 */ - -+ #ifndef MATLAB - exit (0); -+ #endif /* MATLAB */ - } -diff -crB scotch_5.1/src/libscotch/graph.c src/src/libscotch/graph.c -*** scotch_5.1/src/libscotch/graph.c 2008-05-22 06:44:42.000000000 -0700 ---- src/src/libscotch/graph.c 2013-05-06 14:14:17.000000000 -0700 -*************** -*** 135,141 **** - if ((grafptr->velotax != NULL) && /* Free graph tables */ - ((grafptr->flagval & GRAPHVERTGROUP) == 0)) - memFree (grafptr->velotax + grafptr->baseval); -! if (grafptr->vlbltax != NULL) - memFree (grafptr->vlbltax + grafptr->baseval); - if ((grafptr->edlotax != NULL) && - ((grafptr->flagval & GRAPHEDGEGROUP) == 0)) ---- 135,144 ---- - if ((grafptr->velotax != NULL) && /* Free graph tables */ - ((grafptr->flagval & GRAPHVERTGROUP) == 0)) - memFree (grafptr->velotax + grafptr->baseval); -! /* vlbltax must also check GRAPHVERTGROUP (jes, 12/11/09) */ -! // if (grafptr->vlbltax != NULL) -! if ((grafptr->vlbltax != NULL) && -! ((grafptr->flagval & GRAPHVERTGROUP) == 0)) - memFree (grafptr->vlbltax + grafptr->baseval); - if ((grafptr->edlotax != NULL) && - ((grafptr->flagval & GRAPHEDGEGROUP) == 0)) -diff -crB scotch_5.1/src/libscotch/graph.h src/src/libscotch/graph.h -*** scotch_5.1/src/libscotch/graph.h 2008-06-01 02:49:11.000000000 -0700 ---- src/src/libscotch/graph.h 2013-05-06 14:14:17.000000000 -0700 -*************** -*** 159,165 **** ---- 159,169 ---- - int graphInit (Graph * const); - void graphExit (Graph * const); - void graphFree (Graph * const); -+ #ifndef NOFILEIO - int graphLoad (Graph * const, FILE * const, const Gnum, const GraphFlag); -+ #else /* NOFILEIO */ -+ int graphLoad (Graph * const, FILE * const, const Gnum, const GraphFlag, const Gnum, const Gnum, const Gnum*, const Gnum*, const Gnum*, const Gnum*, const Gnum*); -+ #endif /* NOFILEIO */ - int graphLoad2 (const Gnum, const Gnum, const Gnum * const, const Gnum * const, Gnum * restrict const, const Gnum, const Gnum * const); - int graphSave (const Graph * const, FILE * const); - Gnum graphBase (Graph * const, const Gnum); -diff -crB scotch_5.1/src/libscotch/graph_io.c src/src/libscotch/graph_io.c -*** scotch_5.1/src/libscotch/graph_io.c 2008-05-22 06:44:42.000000000 -0700 ---- src/src/libscotch/graph_io.c 2013-05-06 14:14:17.000000000 -0700 -*************** -*** 86,92 **** - Graph * restrict const grafptr, /* Graph structure to fill */ - FILE * const stream, /* Stream from which to read graph data */ - const Gnum baseval, /* Base value (-1 means keep file base) */ -! const GraphFlag flagval) /* Graph loading flags */ - { - Gnum edgenum; /* Number of edges really allocated */ - Gnum edgennd; ---- 86,103 ---- - Graph * restrict const grafptr, /* Graph structure to fill */ - FILE * const stream, /* Stream from which to read graph data */ - const Gnum baseval, /* Base value (-1 means keep file base) */ -! const GraphFlag flagval /* Graph loading flags */ -! #ifdef NOFILEIO -! , -! const Gnum nvert, -! const Gnum nedge2, -! const Gnum* adjir, -! const Gnum* adjjc, -! const Gnum* vertlab, -! const Gnum* vertwgt, -! const Gnum* edgewgt -! #endif /* NOFILEIO */ -! ) - { - Gnum edgenum; /* Number of edges really allocated */ - Gnum edgennd; -*************** -*** 104,120 **** ---- 115,141 ---- - char proptab[4]; - Gnum vertnum; - -+ #ifdef NOFILEIO -+ // printf("graphLoad - stream=%p; nvert=%d,nedge2=%d\n",stream,nvert,nedge2); -+ // printf("graphLoad - adjir=%p,adjjc=%p,vertlab=%p,vertwgt=%p,edgewgt=%p\n", -+ // adjir,adjjc,vertlab,vertwgt,edgewgt); -+ #endif /* NOFILEIO */ - memSet (grafptr, 0, sizeof (Graph)); - -+ #ifndef NOFILEIO - if (intLoad (stream, &versval) != 1) { /* Read version number */ - errorPrint ("graphLoad: bad input (1)"); - return (1); - } -+ #else /* NOFILEIO */ -+ versval=0; -+ #endif /* NOFILEIO */ - if (versval != 0) { /* If version not zero */ - errorPrint ("graphLoad: old-style graph format no longer supported"); - return (1); - } - -+ #ifndef NOFILEIO - if ((intLoad (stream, &grafptr->vertnbr) != 1) || /* Read rest of header */ - (intLoad (stream, &grafptr->edgenbr) != 1) || - (intLoad (stream, &baseadj) != 1) || -*************** -*** 124,129 **** ---- 145,159 ---- - errorPrint ("graphLoad: bad input (2)"); - return (1); - } -+ #else /* NOFILEIO */ -+ grafptr->vertnbr=nvert; -+ grafptr->edgenbr=nedge2; -+ baseadj=1; -+ propval=0; -+ if (vertlab) propval+=100; -+ if (edgewgt) propval+= 10; -+ if (vertwgt) propval+= 1; -+ #endif /* NOFILEIO */ - sprintf (proptab, "%3.3d", (int) propval); /* Compute file properties */ - proptab[0] -= '0'; /* Vertex labels flag */ - proptab[1] -= '0'; /* Edge weights flag */ -*************** -*** 140,145 **** ---- 170,179 ---- - } - if (proptab[0] != 0) /* If vertex labels, no base adjust */ - baseadj = 0; -+ #ifdef NOFILEIO -+ // printf("graphLoad - baseadj=%d,baseval=%d,grafptr->baseval=%d\n", -+ // baseadj,baseval,grafptr->baseval); -+ #endif /* NOFILEIO */ - - velonbr = ((proptab[2] != 0) && ((flagval & GRAPHIONOLOADVERT) == 0)) ? grafptr->vertnbr : 0; - vlblnbr = (proptab[0] != 0) ? grafptr->vertnbr : 0; -*************** -*** 178,188 **** ---- 212,226 ---- - if (grafptr->vlbltax != NULL) { /* If must read label */ - Gnum vlblval; /* Value where to read vertex label */ - -+ #ifndef NOFILEIO - if (intLoad (stream, &vlblval) != 1) { /* Read label data */ - errorPrint ("graphLoad: bad input (3)"); - graphFree (grafptr); - return (1); - } -+ #else /* NOFILEIO */ -+ vlblval=vertlab[vertnum-grafptr->baseval]; -+ #endif /* NOFILEIO */ - grafptr->vlbltax[vertnum] = vlblval; - if (grafptr->vlbltax[vertnum] > vlblmax) /* Get maximum vertex label */ - vlblmax = grafptr->vlbltax[vertnum]; -*************** -*** 190,209 **** ---- 228,257 ---- - if (proptab[2] != 0) { /* If must read vertex load */ - Gnum veloval; /* Value where to read vertex load */ - -+ #ifndef NOFILEIO - if (intLoad (stream, &veloval) != 1) { /* Read vertex load data */ - errorPrint ("graphLoad: bad input (4)"); - graphFree (grafptr); - return (1); - } -+ #else /* NOFILEIO */ -+ veloval=vertwgt[vertnum-grafptr->baseval]; -+ #endif /* NOFILEIO */ - if (grafptr->velotax != NULL) - velosum += - grafptr->velotax[vertnum] = veloval; - } -+ #ifndef NOFILEIO - if (intLoad (stream, °rval) != 1) { /* Read vertex degree */ - errorPrint ("graphLoad: bad input (5)"); - graphFree (grafptr); - return (1); - } -+ #else /* NOFILEIO */ -+ // printf("old degrval=%d; new degrval=%d\n", -+ // degrval,adjjc[vertnum-grafptr->baseval+1]-adjjc[vertnum-grafptr->baseval]); -+ degrval=adjjc[vertnum-grafptr->baseval+1]-adjjc[vertnum-grafptr->baseval]; -+ #endif /* NOFILEIO */ - if (degrmax < degrval) /* Set maximum degree */ - degrmax = degrval; - -*************** -*** 219,238 **** ---- 267,301 ---- - if (proptab[1] != 0) { /* If must read edge load */ - Gnum edloval; /* Value where to read edge load */ - -+ #ifndef NOFILEIO - if (intLoad (stream, &edloval) != 1) { /* Read edge load data */ - errorPrint ("graphLoad: bad input (6)"); - graphFree (grafptr); - return (1); - } -+ #else /* NOFILEIO */ -+ edloval=edgewgt[edgenum-grafptr->baseval]; -+ #endif /* NOFILEIO */ - if (grafptr->edlotax != NULL) - edlosum += - grafptr->edlotax[edgenum] = (Gnum) edloval; - } -+ #ifndef NOFILEIO - if (intLoad (stream, &edgeval) != 1) { /* Read edge data */ - errorPrint ("graphLoad: bad input (7)"); - graphFree (grafptr); - return (1); - } -+ #else /* NOFILEIO */ -+ // printf("edgenum=%d: old edgeval=%d; new edgeval[%d]=%d\n", -+ // edgenum,edgeval,edgenum-grafptr->baseval,adjir[edgenum-grafptr->baseval]+1); -+ /* if vertex labels are supplied, they must be referenced (jes, 1/05/10) */ -+ // edgeval=adjir[edgenum-grafptr->baseval]+1; -+ if (vertlab) -+ edgeval=vertlab[adjir[edgenum-grafptr->baseval] ]; -+ else -+ edgeval= adjir[edgenum-grafptr->baseval]+1; -+ #endif /* NOFILEIO */ - grafptr->edgetax[edgenum] = edgeval + baseadj; - } - } -*************** -*** 279,284 **** ---- 342,351 ---- - Gnum vertnum; /* Number of current vertex */ - Gnum * restrict indxtab; /* Vertex label/number index table */ - -+ #ifdef NOFILEIO -+ printf("graphLoad2 - baseval=%d,vertnnd=%d,vlblmax=%d\n", -+ baseval,vertnnd,vlblmax); -+ #endif /* NOFILEIO */ - if ((indxtab = (Gnum *) memAlloc ((vlblmax + 1) * sizeof (Gnum))) == NULL) { - errorPrint ("graphLoad2: out of memory"); - return (1); -*************** -*** 286,291 **** ---- 353,362 ---- - - memSet (indxtab, ~0, (vlblmax + 1) * sizeof (Gnum)); /* Assume labels not used */ - for (vertnum = baseval; vertnum < vertnnd; vertnum ++) { -+ #ifdef NOFILEIO -+ // printf("graphLoad2 - vertnum=%d; vlbltax=%d,indxtab=%d\n", -+ // vertnum,vlbltax[vertnum],indxtab[vlbltax[vertnum]]); -+ #endif /* NOFILEIO */ - if (indxtab[vlbltax[vertnum]] != ~0) { /* If vertex label already used */ - errorPrint ("graphLoad2: duplicate vertex label"); - memFree (indxtab); -*************** -*** 294,299 **** ---- 365,374 ---- - indxtab[vlbltax[vertnum]] = vertnum; /* Set vertex number index */ - } - for (vertnum = baseval; vertnum < vertnnd; vertnum ++) { -+ #ifdef NOFILEIO -+ // printf("graphLoad2 - vertnum=%d; vlbltax=%d,indxtab=%d\n", -+ // vertnum,vlbltax[vertnum],indxtab[vlbltax[vertnum]]); -+ #endif /* NOFILEIO */ - Gnum edgenum; /* Number of current edge */ - - for (edgenum = verttax[vertnum]; edgenum < vendtax[vertnum]; edgenum ++) { -*************** -*** 307,313 **** ---- 382,396 ---- - memFree (indxtab); - return (1); - } -+ #ifdef NOFILEIO -+ // printf("graphLoad2 - edgenum=%d; old edgetax=%d,", -+ // edgenum,edgetax[edgenum]); -+ #endif /* NOFILEIO */ - edgetax[edgenum] = indxtab[edgetax[edgenum]]; /* Replace label by number */ -+ #ifdef NOFILEIO -+ // printf("new edgetax=%d\n", -+ // edgetax[edgenum]); -+ #endif /* NOFILEIO */ - } - } - -diff -crB scotch_5.1/src/libscotch/graph_io_scot.c src/src/libscotch/graph_io_scot.c -*** scotch_5.1/src/libscotch/graph_io_scot.c 2008-05-22 06:44:42.000000000 -0700 ---- src/src/libscotch/graph_io_scot.c 2013-05-06 14:14:17.000000000 -0700 -*************** -*** 89,95 **** ---- 89,99 ---- - int o; - - if (filesrcptr != NULL) { -+ #ifndef NOFILEIO - if (graphLoad (grafptr, filesrcptr, -1, 0) != 0) -+ #else /* NOFILEIO */ -+ if (graphLoad (grafptr, filesrcptr, -1, 0, 0, 0, NULL, NULL, NULL, NULL, NULL) != 0) -+ #endif /* NOFILEIO */ - return (1); - } - -diff -crB scotch_5.1/src/libscotch/library_arch.c src/src/libscotch/library_arch.c -*** scotch_5.1/src/libscotch/library_arch.c 2008-05-22 06:44:42.000000000 -0700 ---- src/src/libscotch/library_arch.c 2013-05-06 14:14:17.000000000 -0700 -*************** -*** 120,128 **** - int - SCOTCH_archLoad ( - SCOTCH_Arch * const archptr, -! FILE * const stream) - { - return (archLoad ((Arch *) archptr, stream)); - } - - /*+ This routine saves the given opaque ---- 120,139 ---- - int - SCOTCH_archLoad ( - SCOTCH_Arch * const archptr, -! FILE * const stream -! #ifdef NOFILEIO -! , -! const char * archtyp, -! const SCOTCH_Num napar, -! const SCOTCH_Num * archpar -! #endif /* NOFILEIO */ -! ) - { -+ #ifndef NOFILEIO - return (archLoad ((Arch *) archptr, stream)); -+ #else /* NOFILEIO */ -+ return (archLoad ((Arch *) archptr, stream, archtyp, napar, archpar)); -+ #endif /* NOFILEIO */ - } - - /*+ This routine saves the given opaque -diff -crB scotch_5.1/src/libscotch/library_arch_f.c src/src/libscotch/library_arch_f.c -*** scotch_5.1/src/libscotch/library_arch_f.c 2008-05-22 06:44:42.000000000 -0700 ---- src/src/libscotch/library_arch_f.c 2013-05-06 14:14:18.000000000 -0700 -*************** -*** 121,127 **** ---- 121,131 ---- - } - setbuf (stream, NULL); /* Do not buffer on input */ - -+ #ifndef NOFILEIO - o = SCOTCH_archLoad (archptr, stream); -+ #else /* NOFILEIO */ -+ o = SCOTCH_archLoad (archptr, stream, "", 0, NULL); -+ #endif /* NOFILEIO */ - - fclose (stream); /* This closes filenum too */ - -diff -crB scotch_5.1/src/libscotch/library_error_exit.c src/src/libscotch/library_error_exit.c -*** scotch_5.1/src/libscotch/library_error_exit.c 2009-01-20 00:36:33.000000000 -0800 ---- src/src/libscotch/library_error_exit.c 2013-05-06 14:14:18.000000000 -0700 -*************** -*** 114,119 **** ---- 114,120 ---- - int proclocnum; - #endif /* SCOTCH_PTSCOTCH */ - -+ #ifndef MATLAB - fprintf (stderr, "%s", _SCOTCHerrorProgName); - #ifdef SCOTCH_PTSCOTCH - if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) && -*************** -*** 131,136 **** ---- 132,155 ---- - fprintf (stderr, "\n"); - fflush (stderr); /* In case it has been set to buffered mode */ - -+ #else /* MATLAB */ -+ mexPrintf ("%s", _SCOTCHerrorProgName); -+ #ifdef SCOTCH_PTSCOTCH -+ if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) && -+ (proclocnum != 0) && -+ (MPI_Comm_rank (MPI_COMM_WORLD, &proclocnum) == MPI_SUCCESS)) -+ mexPrintf ("(%d): ", proclocnum); -+ #else /* SCOTCH_PTSCOTCH */ -+ if (_SCOTCHerrorProgName[0] != '\0') -+ mexPrintf (": "); -+ #endif /* SCOTCH_PTSCOTCH */ -+ mexPrintf ("ERROR: "); -+ va_start (errlist, errstr); -+ mexPrintf (errstr, errlist); /* Print arguments */ -+ va_end (errlist); -+ mexPrintf ("\n"); -+ #endif /* MATLAB */ -+ - #ifdef SCOTCH_ERROR_SLEEP - sleep (SCOTCH_ERROR_SLEEP); /* Wait for messages to be propagated */ - #endif /* SCOTCH_ERROR_SLEEP */ -*************** -*** 155,160 **** ---- 174,180 ---- - int proclocnum; - #endif /* SCOTCH_PTSCOTCH */ - -+ #ifndef MATLAB - fprintf (stderr, "%s", _SCOTCHerrorProgName); - #ifdef SCOTCH_PTSCOTCH - if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) && -*************** -*** 171,174 **** ---- 191,212 ---- - va_end (errlist); - fprintf (stderr, "\n"); - fflush (stderr); /* In case it has been set to buffered mode */ -+ -+ #else /* MATLAB */ -+ mexPrintf ("%s", _SCOTCHerrorProgName); -+ #ifdef SCOTCH_PTSCOTCH -+ if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) && -+ (proclocnum != 0) && -+ (MPI_Comm_rank (MPI_COMM_WORLD, &proclocnum) == MPI_SUCCESS)) -+ mexPrintf ("(%d): ", proclocnum); -+ #else /* SCOTCH_PTSCOTCH */ -+ if (_SCOTCHerrorProgName[0] != '\0') -+ mexPrintf (": "); -+ #endif /* SCOTCH_PTSCOTCH */ -+ mexPrintf ("WARNING: "); -+ va_start (errlist, errstr); -+ mexPrintf (errstr, errlist); /* Print arguments */ -+ va_end (errlist); -+ mexPrintf ("\n"); -+ #endif /* MATLAB */ - } -diff -crB scotch_5.1/src/libscotch/library_graph.c src/src/libscotch/library_graph.c -*** scotch_5.1/src/libscotch/library_graph.c 2008-05-22 07:28:12.000000000 -0700 ---- src/src/libscotch/library_graph.c 2013-05-06 14:14:18.000000000 -0700 -*************** -*** 137,143 **** - SCOTCH_Graph * const grafptr, - FILE * const stream, - const SCOTCH_Num baseval, -! const SCOTCH_Num flagval) - { - GraphFlag srcgrafflag; /* Graph flags */ - ---- 137,154 ---- - SCOTCH_Graph * const grafptr, - FILE * const stream, - const SCOTCH_Num baseval, -! const SCOTCH_Num flagval -! #ifdef NOFILEIO -! , -! const SCOTCH_Num nvert, -! const SCOTCH_Num nedge2, -! const SCOTCH_Num* adjir, -! const SCOTCH_Num* adjjc, -! const SCOTCH_Num* vertlab, -! const SCOTCH_Num* vertwgt, -! const SCOTCH_Num* edgewgt -! #endif /* NOFILEIO */ -! ) - { - GraphFlag srcgrafflag; /* Graph flags */ - -*************** -*** 153,159 **** ---- 164,174 ---- - srcgrafflag = (((flagval & 1) != 0) ? GRAPHIONOLOADVERT : 0) + - (((flagval & 2) != 0) ? GRAPHIONOLOADEDGE : 0); - -+ #ifndef NOFILEIO - return (graphLoad ((Graph * const) grafptr, stream, (Gnum) baseval, srcgrafflag)); -+ #else /* NOFILEIO */ -+ return (graphLoad ((Graph * const) grafptr, stream, (Gnum) baseval, srcgrafflag, (const Gnum) nvert, (const Gnum) nedge2, (const Gnum *) adjir, (const Gnum *) adjjc, (const Gnum *) vertlab, (const Gnum *) vertwgt, (const Gnum *) edgewgt)); -+ #endif /* NOFILEIO */ - } - - /*+ This routine saves the contents of the given -diff -crB scotch_5.1/src/libscotch/library_graph_f.c src/src/libscotch/library_graph_f.c -*** scotch_5.1/src/libscotch/library_graph_f.c 2008-05-22 06:44:43.000000000 -0700 ---- src/src/libscotch/library_graph_f.c 2013-05-06 14:14:18.000000000 -0700 -*************** -*** 136,142 **** ---- 136,146 ---- - } - setbuf (stream, NULL); /* Do not buffer on input */ - -+ #ifndef NOFILEIO - o = SCOTCH_graphLoad (grafptr, stream, *baseptr, *flagptr); -+ #else /* NOFILEIO */ -+ o = SCOTCH_graphLoad (grafptr, stream, *baseptr, *flagptr, 0, 0, NULL, NULL, NULL, NULL, NULL); -+ #endif /* NOFILEIO */ - - fclose (stream); /* This closes filenum too */ - -diff -crB scotch_5.1/src/libscotch/library_graph_map.c src/src/libscotch/library_graph_map.c -*** scotch_5.1/src/libscotch/library_graph_map.c 2008-09-28 04:04:05.000000000 -0700 ---- src/src/libscotch/library_graph_map.c 2013-05-06 14:14:19.000000000 -0700 -*************** -*** 182,192 **** ---- 182,200 ---- - - int - SCOTCH_graphMapSave ( -+ #ifdef NOFILEIO -+ Gnum *pnvert, -+ Gnum (**pmaptab)[2], -+ #endif /* NOFILEIO */ - const SCOTCH_Graph * const grafptr, /*+ Graph to order +*/ - const SCOTCH_Mapping * const mappptr, /*+ Mapping to save +*/ - FILE * const stream) /*+ Output stream +*/ - { -+ #ifndef NOFILEIO - return (mapSave (&((LibMapping *) mappptr)->m, ((Graph *) grafptr)->vlbltax, stream)); -+ #else /* NOFILEIO */ -+ return (mapSave (pnvert, pmaptab, &((LibMapping *) mappptr)->m, ((Graph *) grafptr)->vlbltax, stream)); -+ #endif /* NOFILEIO */ - } - - /*+ This routine computes a mapping -diff -crB scotch_5.1/src/libscotch/library_graph_map_f.c src/src/libscotch/library_graph_map_f.c -*** scotch_5.1/src/libscotch/library_graph_map_f.c 2008-06-28 03:44:26.000000000 -0700 ---- src/src/libscotch/library_graph_map_f.c 2013-05-06 14:14:19.000000000 -0700 -*************** -*** 183,189 **** ---- 183,193 ---- - return; - } - -+ #ifndef NOFILEIO - o = SCOTCH_graphMapSave (grafptr, mapptr, stream); -+ #else /* NOFILEIO */ -+ o = SCOTCH_graphMapSave (NULL, NULL, grafptr, mapptr, stream); -+ #endif /* NOFILEIO */ - - fclose (stream); /* This closes filenum too */ - -diff -crB scotch_5.1/src/libscotch/library.h src/src/libscotch/library.h -*** scotch_5.1/src/libscotch/library.h 2009-05-09 16:08:03.000000000 -0700 ---- src/src/libscotch/library.h 2013-05-06 14:14:19.000000000 -0700 -*************** -*** 1,3 **** ---- 1,5 ---- -+ #ifndef _SCOTCH_H_ -+ #define _SCOTCH_H_ - /* Copyright 2004,2007-2009 ENSEIRB, INRIA & CNRS - ** - ** This file is part of the Scotch software package for static mapping, -*************** -*** 134,140 **** ---- 136,146 ---- - - int SCOTCH_archInit (SCOTCH_Arch * const); - void SCOTCH_archExit (SCOTCH_Arch * const); -+ #ifndef NOFILEIO - int SCOTCH_archLoad (SCOTCH_Arch * const, FILE * const); -+ #else /* NOFILEIO */ -+ int SCOTCH_archLoad (SCOTCH_Arch * const, FILE * const, const char *, const SCOTCH_Num, const SCOTCH_Num *); -+ #endif /* NOFILEIO */ - int SCOTCH_archSave (const SCOTCH_Arch * const, FILE * const); - int SCOTCH_archBuild (SCOTCH_Arch * const, const SCOTCH_Graph * const, const SCOTCH_Num, const SCOTCH_Num * const, const SCOTCH_Strat * const); - int SCOTCH_archCmplt (SCOTCH_Arch * const, const SCOTCH_Num); -*************** -*** 191,197 **** ---- 197,207 ---- - int SCOTCH_graphInit (SCOTCH_Graph * const); - void SCOTCH_graphExit (SCOTCH_Graph * const); - void SCOTCH_graphFree (SCOTCH_Graph * const); -+ #ifndef NOFILEIO - int SCOTCH_graphLoad (SCOTCH_Graph * const, FILE * const, const SCOTCH_Num, const SCOTCH_Num); -+ #else /* NOFILEIO */ -+ int SCOTCH_graphLoad (SCOTCH_Graph * const, FILE * const, const SCOTCH_Num, const SCOTCH_Num, const SCOTCH_Num, const SCOTCH_Num, const SCOTCH_Num *, const SCOTCH_Num *, const SCOTCH_Num *, const SCOTCH_Num *, const SCOTCH_Num *); -+ #endif /* NOFILEIO */ - int SCOTCH_graphSave (const SCOTCH_Graph * const, FILE * const); - int SCOTCH_graphBuild (SCOTCH_Graph * const, const SCOTCH_Num, const SCOTCH_Num, const SCOTCH_Num * const, const SCOTCH_Num * const, const SCOTCH_Num * const, const SCOTCH_Num * const, const SCOTCH_Num, const SCOTCH_Num * const, const SCOTCH_Num * const); - SCOTCH_Num SCOTCH_graphBase (SCOTCH_Graph * const, const SCOTCH_Num baseval); -*************** -*** 210,216 **** ---- 220,230 ---- - int SCOTCH_graphMapInit (const SCOTCH_Graph * const, SCOTCH_Mapping * const, const SCOTCH_Arch * const, SCOTCH_Num * const); - void SCOTCH_graphMapExit (const SCOTCH_Graph * const, SCOTCH_Mapping * const); - int SCOTCH_graphMapLoad (const SCOTCH_Graph * const, const SCOTCH_Mapping * const, FILE * const); -+ #ifndef NOFILEIO - int SCOTCH_graphMapSave (const SCOTCH_Graph * const, const SCOTCH_Mapping * const, FILE * const); -+ #else /* NOFILEIO */ -+ int SCOTCH_graphMapSave (SCOTCH_Num *, SCOTCH_Num (**)[2], const SCOTCH_Graph * const, const SCOTCH_Mapping * const, FILE * const); -+ #endif /* NOFILEIO */ - int SCOTCH_graphMapView (const SCOTCH_Graph * const, const SCOTCH_Mapping * const, FILE * const); - int SCOTCH_graphMapCompute (const SCOTCH_Graph * const, SCOTCH_Mapping * const, const SCOTCH_Strat * const); - int SCOTCH_graphMap (const SCOTCH_Graph * const, const SCOTCH_Arch * const, const SCOTCH_Strat * const, SCOTCH_Num * const); -*************** -*** 278,280 **** ---- 292,296 ---- - #ifdef __cplusplus - } - #endif /* __cplusplus */ -+ -+ #endif //#ifndef _SCOTCH_H_ -diff -crB scotch_5.1/src/libscotch/Makefile src/src/libscotch/Makefile -*** scotch_5.1/src/libscotch/Makefile 2009-05-09 16:08:04.000000000 -0700 ---- src/src/libscotch/Makefile 2013-05-06 14:14:19.000000000 -0700 -*************** -*** 49,55 **** - ## Project rules. - ## - -! .PHONY : ptscotch scotch ptinstall install clean realclean - - scotch : clean - $(MAKE) CC="$(CCS)" CCD="$(CCS)" SCOTCHLIB=scotch \ ---- 49,55 ---- - ## Project rules. - ## - -! .PHONY : ptscotch scotch nfioscotch mexscotch ptinstall install nfioinstall mexinstall clean realclean - - scotch : clean - $(MAKE) CC="$(CCS)" CCD="$(CCS)" SCOTCHLIB=scotch \ -*************** -*** 68,73 **** ---- 68,93 ---- - libptscotcherr$(LIB) \ - libptscotcherrexit$(LIB) - -+ nfioscotch : clean -+ $(MAKE) CFLAGS="$(CFLAGS)" CC="$(CCS)" CCD="$(CCS)" LDFLAGS="$(LDFLAGS)" SCOTCHLIB=scotch \ -+ dummysizes$(EXE) -+ $(MAKE) CFLAGS="$(CFLAGS) -DNOFILEIO" CC="$(CCS)" CCD="$(CCS)" SCOTCHLIB=nfioscotch \ -+ scotch.h \ -+ scotchf.h \ -+ libnfioscotch$(LIB) \ -+ libnfioscotcherr$(LIB) \ -+ libnfioscotcherrexit$(LIB) -+ -+ mexscotch : clean -+ $(MAKE) CFLAGS="$(CFLAGS)" CC="$(CCS)" CCD="$(CCS)" LDFLAGS="$(LDFLAGS)" SCOTCHLIB=scotch \ -+ dummysizes$(EXE) -+ $(MAKE) CFLAGS="$(CFLAGS) -DNOFILEIO -DMATLAB -I${MATLAB_DIR}/extern/include" CC="$(CCS)" CCD="$(CCS)" LDFLAGS="$(LDFLAGS) -Wl,-rpath-link,${MATLAB_DIR}/bin/glnxa64 -L${MATLAB_DIR}/bin/glnxa64 -lmex -lmat" SCOTCHLIB=mexscotch \ -+ scotch.h \ -+ scotchf.h \ -+ libmexscotch$(LIB) \ -+ libmexscotcherr$(LIB) \ -+ libmexscotcherrexit$(LIB) -+ - install : - -$(CP) scotch.h scotchf.h $(includedir) - -$(CP) libscotch$(LIB) libscotcherr*$(LIB) $(libdir) -*************** -*** 77,82 **** ---- 97,110 ---- - -$(CP) scotchf.h $(includedir)/ptscotchf.h - -$(CP) libptscotch*$(LIB) $(libdir) - -+ nfioinstall : -+ -$(CP) scotch.h scotchf.h $(includedir) -+ -$(CP) libnfioscotch$(LIB) libnfioscotcherr*$(LIB) $(libdir) -+ -+ mexinstall : -+ -$(CP) scotch.h scotchf.h $(includedir) -+ -$(CP) libmexscotch$(LIB) libmexscotcherr*$(LIB) $(libdir) -+ - clean : - -$(RM) *~ *$(OBJ) lib*$(LIB) common2* parser_yy.c parser_ly.h parser_ll.c *scotch.h *scotchf.h y.output dummysizes$(EXE) - -*************** -*** 2452,2457 **** ---- 2480,2807 ---- - $(AR) $(ARFLAGS) lib$(SCOTCHLIB)$(LIB) $(?) - -$(RANLIB) lib$(SCOTCHLIB)$(LIB) - -+ libnfioscotch$(LIB) : arch$(OBJ) \ -+ arch_build$(OBJ) \ -+ arch_cmplt$(OBJ) \ -+ arch_cmpltw$(OBJ) \ -+ arch_deco$(OBJ) \ -+ arch_hcub$(OBJ) \ -+ arch_mesh$(OBJ) \ -+ arch_tleaf$(OBJ) \ -+ arch_torus$(OBJ) \ -+ arch_vcmplt$(OBJ) \ -+ arch_vhcub$(OBJ) \ -+ bgraph$(OBJ) \ -+ bgraph_bipart_bd$(OBJ) \ -+ bgraph_bipart_df$(OBJ) \ -+ bgraph_bipart_ex$(OBJ) \ -+ bgraph_bipart_fm$(OBJ) \ -+ bgraph_bipart_gg$(OBJ) \ -+ bgraph_bipart_gp$(OBJ) \ -+ bgraph_bipart_ml$(OBJ) \ -+ bgraph_bipart_st$(OBJ) \ -+ bgraph_bipart_zr$(OBJ) \ -+ bgraph_check$(OBJ) \ -+ bgraph_store$(OBJ) \ -+ common$(OBJ) \ -+ common_file$(OBJ) \ -+ common_file_compress$(OBJ) \ -+ common_file_uncompress$(OBJ) \ -+ common_integer$(OBJ) \ -+ common_memory$(OBJ) \ -+ common_stub$(OBJ) \ -+ gain$(OBJ) \ -+ geom$(OBJ) \ -+ graph$(OBJ) \ -+ graph_base$(OBJ) \ -+ graph_check$(OBJ) \ -+ graph_coarsen$(OBJ) \ -+ graph_induce$(OBJ) \ -+ graph_io$(OBJ) \ -+ graph_io_chac$(OBJ) \ -+ graph_io_habo$(OBJ) \ -+ graph_io_mmkt$(OBJ) \ -+ graph_io_scot$(OBJ) \ -+ graph_list$(OBJ) \ -+ hall_order_hd$(OBJ) \ -+ hall_order_hf$(OBJ) \ -+ hall_order_hx$(OBJ) \ -+ hgraph$(OBJ) \ -+ hgraph_check$(OBJ) \ -+ hgraph_induce$(OBJ) \ -+ hgraph_order_bl$(OBJ) \ -+ hgraph_order_cp$(OBJ) \ -+ hgraph_order_gp$(OBJ) \ -+ hgraph_order_hd$(OBJ) \ -+ hgraph_order_hf$(OBJ) \ -+ hgraph_order_hx$(OBJ) \ -+ hgraph_order_nd$(OBJ) \ -+ hgraph_order_si$(OBJ) \ -+ hgraph_order_st$(OBJ) \ -+ hmesh$(OBJ) \ -+ hmesh_check$(OBJ) \ -+ hmesh_hgraph$(OBJ) \ -+ hmesh_induce$(OBJ) \ -+ hmesh_mesh$(OBJ) \ -+ hmesh_order_bl$(OBJ) \ -+ hmesh_order_cp$(OBJ) \ -+ hmesh_order_gr$(OBJ) \ -+ hmesh_order_gp$(OBJ) \ -+ hmesh_order_hd$(OBJ) \ -+ hmesh_order_hf$(OBJ) \ -+ hmesh_order_hx$(OBJ) \ -+ hmesh_order_nd$(OBJ) \ -+ hmesh_order_si$(OBJ) \ -+ hmesh_order_st$(OBJ) \ -+ kgraph$(OBJ) \ -+ kgraph_map_rb$(OBJ) \ -+ kgraph_map_rb_map$(OBJ) \ -+ kgraph_map_rb_part$(OBJ) \ -+ kgraph_map_st$(OBJ) \ -+ library_arch$(OBJ) \ -+ library_arch_f$(OBJ) \ -+ library_arch_build$(OBJ) \ -+ library_arch_build_f$(OBJ) \ -+ library_arch_cmpltw$(OBJ) \ -+ library_arch_cmpltw_f$(OBJ) \ -+ library_geom$(OBJ) \ -+ library_geom_f$(OBJ) \ -+ library_graph$(OBJ) \ -+ library_graph_f$(OBJ) \ -+ library_graph_base$(OBJ) \ -+ library_graph_base_f$(OBJ) \ -+ library_graph_check$(OBJ) \ -+ library_graph_check_f$(OBJ) \ -+ library_graph_io_chac$(OBJ) \ -+ library_graph_io_chac_f$(OBJ) \ -+ library_graph_io_habo$(OBJ) \ -+ library_graph_io_habo_f$(OBJ) \ -+ library_graph_io_mmkt$(OBJ) \ -+ library_graph_io_mmkt_f$(OBJ) \ -+ library_graph_io_scot$(OBJ) \ -+ library_graph_io_scot_f$(OBJ) \ -+ library_graph_map$(OBJ) \ -+ library_graph_map_f$(OBJ) \ -+ library_graph_map_view$(OBJ) \ -+ library_graph_map_view_f$(OBJ) \ -+ library_graph_order$(OBJ) \ -+ library_graph_order_f$(OBJ) \ -+ library_mesh$(OBJ) \ -+ library_mesh_f$(OBJ) \ -+ library_mesh_graph$(OBJ) \ -+ library_mesh_graph_f$(OBJ) \ -+ library_mesh_io_habo$(OBJ) \ -+ library_mesh_io_habo_f$(OBJ) \ -+ library_mesh_io_scot$(OBJ) \ -+ library_mesh_io_scot_f$(OBJ) \ -+ library_mesh_order$(OBJ) \ -+ library_mesh_order_f$(OBJ) \ -+ library_parser$(OBJ) \ -+ library_parser_f$(OBJ) \ -+ library_random$(OBJ) \ -+ library_random_f$(OBJ) \ -+ mapping$(OBJ) \ -+ mapping_io$(OBJ) \ -+ mesh$(OBJ) \ -+ mesh_check$(OBJ) \ -+ mesh_coarsen$(OBJ) \ -+ mesh_graph$(OBJ) \ -+ mesh_induce_sepa$(OBJ) \ -+ mesh_io$(OBJ) \ -+ mesh_io_habo$(OBJ) \ -+ mesh_io_scot$(OBJ) \ -+ order$(OBJ) \ -+ order_check$(OBJ) \ -+ order_io$(OBJ) \ -+ parser$(OBJ) \ -+ parser_ll$(OBJ) \ -+ parser_yy$(OBJ) \ -+ vgraph$(OBJ) \ -+ vgraph_check$(OBJ) \ -+ vgraph_separate_bd$(OBJ) \ -+ vgraph_separate_es$(OBJ) \ -+ vgraph_separate_fm$(OBJ) \ -+ vgraph_separate_gg$(OBJ) \ -+ vgraph_separate_gp$(OBJ) \ -+ vgraph_separate_ml$(OBJ) \ -+ vgraph_separate_st$(OBJ) \ -+ vgraph_separate_th$(OBJ) \ -+ vgraph_separate_vw$(OBJ) \ -+ vgraph_separate_zr$(OBJ) \ -+ vgraph_store$(OBJ) \ -+ vmesh$(OBJ) \ -+ vmesh_check$(OBJ) \ -+ vmesh_separate_fm$(OBJ) \ -+ vmesh_separate_gg$(OBJ) \ -+ vmesh_separate_gr$(OBJ) \ -+ vmesh_separate_ml$(OBJ) \ -+ vmesh_separate_zr$(OBJ) \ -+ vmesh_separate_st$(OBJ) \ -+ vmesh_store$(OBJ) -+ $(AR) $(ARFLAGS) lib$(SCOTCHLIB)$(LIB) $(?) -+ -$(RANLIB) lib$(SCOTCHLIB)$(LIB) -+ -+ libmexscotch$(LIB) : arch$(OBJ) \ -+ arch_build$(OBJ) \ -+ arch_cmplt$(OBJ) \ -+ arch_cmpltw$(OBJ) \ -+ arch_deco$(OBJ) \ -+ arch_hcub$(OBJ) \ -+ arch_mesh$(OBJ) \ -+ arch_tleaf$(OBJ) \ -+ arch_torus$(OBJ) \ -+ arch_vcmplt$(OBJ) \ -+ arch_vhcub$(OBJ) \ -+ bgraph$(OBJ) \ -+ bgraph_bipart_bd$(OBJ) \ -+ bgraph_bipart_df$(OBJ) \ -+ bgraph_bipart_ex$(OBJ) \ -+ bgraph_bipart_fm$(OBJ) \ -+ bgraph_bipart_gg$(OBJ) \ -+ bgraph_bipart_gp$(OBJ) \ -+ bgraph_bipart_ml$(OBJ) \ -+ bgraph_bipart_st$(OBJ) \ -+ bgraph_bipart_zr$(OBJ) \ -+ bgraph_check$(OBJ) \ -+ bgraph_store$(OBJ) \ -+ common$(OBJ) \ -+ common_file$(OBJ) \ -+ common_file_compress$(OBJ) \ -+ common_file_uncompress$(OBJ) \ -+ common_integer$(OBJ) \ -+ common_memory$(OBJ) \ -+ common_stub$(OBJ) \ -+ gain$(OBJ) \ -+ geom$(OBJ) \ -+ graph$(OBJ) \ -+ graph_base$(OBJ) \ -+ graph_check$(OBJ) \ -+ graph_coarsen$(OBJ) \ -+ graph_induce$(OBJ) \ -+ graph_io$(OBJ) \ -+ graph_io_chac$(OBJ) \ -+ graph_io_habo$(OBJ) \ -+ graph_io_mmkt$(OBJ) \ -+ graph_io_scot$(OBJ) \ -+ graph_list$(OBJ) \ -+ hall_order_hd$(OBJ) \ -+ hall_order_hf$(OBJ) \ -+ hall_order_hx$(OBJ) \ -+ hgraph$(OBJ) \ -+ hgraph_check$(OBJ) \ -+ hgraph_induce$(OBJ) \ -+ hgraph_order_bl$(OBJ) \ -+ hgraph_order_cp$(OBJ) \ -+ hgraph_order_gp$(OBJ) \ -+ hgraph_order_hd$(OBJ) \ -+ hgraph_order_hf$(OBJ) \ -+ hgraph_order_hx$(OBJ) \ -+ hgraph_order_nd$(OBJ) \ -+ hgraph_order_si$(OBJ) \ -+ hgraph_order_st$(OBJ) \ -+ hmesh$(OBJ) \ -+ hmesh_check$(OBJ) \ -+ hmesh_hgraph$(OBJ) \ -+ hmesh_induce$(OBJ) \ -+ hmesh_mesh$(OBJ) \ -+ hmesh_order_bl$(OBJ) \ -+ hmesh_order_cp$(OBJ) \ -+ hmesh_order_gr$(OBJ) \ -+ hmesh_order_gp$(OBJ) \ -+ hmesh_order_hd$(OBJ) \ -+ hmesh_order_hf$(OBJ) \ -+ hmesh_order_hx$(OBJ) \ -+ hmesh_order_nd$(OBJ) \ -+ hmesh_order_si$(OBJ) \ -+ hmesh_order_st$(OBJ) \ -+ kgraph$(OBJ) \ -+ kgraph_map_rb$(OBJ) \ -+ kgraph_map_rb_map$(OBJ) \ -+ kgraph_map_rb_part$(OBJ) \ -+ kgraph_map_st$(OBJ) \ -+ library_arch$(OBJ) \ -+ library_arch_f$(OBJ) \ -+ library_arch_build$(OBJ) \ -+ library_arch_build_f$(OBJ) \ -+ library_arch_cmpltw$(OBJ) \ -+ library_arch_cmpltw_f$(OBJ) \ -+ library_geom$(OBJ) \ -+ library_geom_f$(OBJ) \ -+ library_graph$(OBJ) \ -+ library_graph_f$(OBJ) \ -+ library_graph_base$(OBJ) \ -+ library_graph_base_f$(OBJ) \ -+ library_graph_check$(OBJ) \ -+ library_graph_check_f$(OBJ) \ -+ library_graph_io_chac$(OBJ) \ -+ library_graph_io_chac_f$(OBJ) \ -+ library_graph_io_habo$(OBJ) \ -+ library_graph_io_habo_f$(OBJ) \ -+ library_graph_io_mmkt$(OBJ) \ -+ library_graph_io_mmkt_f$(OBJ) \ -+ library_graph_io_scot$(OBJ) \ -+ library_graph_io_scot_f$(OBJ) \ -+ library_graph_map$(OBJ) \ -+ library_graph_map_f$(OBJ) \ -+ library_graph_map_view$(OBJ) \ -+ library_graph_map_view_f$(OBJ) \ -+ library_graph_order$(OBJ) \ -+ library_graph_order_f$(OBJ) \ -+ library_mesh$(OBJ) \ -+ library_mesh_f$(OBJ) \ -+ library_mesh_graph$(OBJ) \ -+ library_mesh_graph_f$(OBJ) \ -+ library_mesh_io_habo$(OBJ) \ -+ library_mesh_io_habo_f$(OBJ) \ -+ library_mesh_io_scot$(OBJ) \ -+ library_mesh_io_scot_f$(OBJ) \ -+ library_mesh_order$(OBJ) \ -+ library_mesh_order_f$(OBJ) \ -+ library_parser$(OBJ) \ -+ library_parser_f$(OBJ) \ -+ library_random$(OBJ) \ -+ library_random_f$(OBJ) \ -+ mapping$(OBJ) \ -+ mapping_io$(OBJ) \ -+ mesh$(OBJ) \ -+ mesh_check$(OBJ) \ -+ mesh_coarsen$(OBJ) \ -+ mesh_graph$(OBJ) \ -+ mesh_induce_sepa$(OBJ) \ -+ mesh_io$(OBJ) \ -+ mesh_io_habo$(OBJ) \ -+ mesh_io_scot$(OBJ) \ -+ order$(OBJ) \ -+ order_check$(OBJ) \ -+ order_io$(OBJ) \ -+ parser$(OBJ) \ -+ parser_ll$(OBJ) \ -+ parser_yy$(OBJ) \ -+ vgraph$(OBJ) \ -+ vgraph_check$(OBJ) \ -+ vgraph_separate_bd$(OBJ) \ -+ vgraph_separate_es$(OBJ) \ -+ vgraph_separate_fm$(OBJ) \ -+ vgraph_separate_gg$(OBJ) \ -+ vgraph_separate_gp$(OBJ) \ -+ vgraph_separate_ml$(OBJ) \ -+ vgraph_separate_st$(OBJ) \ -+ vgraph_separate_th$(OBJ) \ -+ vgraph_separate_vw$(OBJ) \ -+ vgraph_separate_zr$(OBJ) \ -+ vgraph_store$(OBJ) \ -+ vmesh$(OBJ) \ -+ vmesh_check$(OBJ) \ -+ vmesh_separate_fm$(OBJ) \ -+ vmesh_separate_gg$(OBJ) \ -+ vmesh_separate_gr$(OBJ) \ -+ vmesh_separate_ml$(OBJ) \ -+ vmesh_separate_zr$(OBJ) \ -+ vmesh_separate_st$(OBJ) \ -+ vmesh_store$(OBJ) -+ $(AR) $(ARFLAGS) lib$(SCOTCHLIB)$(LIB) $(?) -+ -$(RANLIB) lib$(SCOTCHLIB)$(LIB) -+ - libptscotcherr$(LIB) : library_error$(OBJ) - $(AR) $(ARFLAGS) $(@) $(?) - -$(RANLIB) $(@) -*************** -*** 2467,2469 **** ---- 2817,2835 ---- - libscotcherrexit$(LIB) : library_error_exit$(OBJ) - $(AR) $(ARFLAGS) $(@) $(?) - -$(RANLIB) $(@) -+ -+ libnfioscotcherr$(LIB) : library_error$(OBJ) -+ $(AR) $(ARFLAGS) $(@) $(?) -+ -$(RANLIB) $(@) -+ -+ libnfioscotcherrexit$(LIB) : library_error_exit$(OBJ) -+ $(AR) $(ARFLAGS) $(@) $(?) -+ -$(RANLIB) $(@) -+ -+ libmexscotcherr$(LIB) : library_error$(OBJ) -+ $(AR) $(ARFLAGS) $(@) $(?) -+ -$(RANLIB) $(@) -+ -+ libmexscotcherrexit$(LIB) : library_error_exit$(OBJ) -+ $(AR) $(ARFLAGS) $(@) $(?) -+ -$(RANLIB) $(@) -diff -crB scotch_5.1/src/libscotch/mapping.h src/src/libscotch/mapping.h -*** scotch_5.1/src/libscotch/mapping.h 2008-10-27 08:27:47.000000000 -0700 ---- src/src/libscotch/mapping.h 2013-05-06 14:14:20.000000000 -0700 -*************** -*** 106,112 **** ---- 106,116 ---- - int mapInit2 (Mapping * restrict const, const Gnum, const Gnum, const Arch * restrict const, const ArchDom * restrict const); - void mapExit (Mapping * const); - int mapLoad (Mapping * restrict const, const Gnum * restrict const, FILE * restrict const); -+ #ifndef NOFILEIO - int mapSave (const Mapping * restrict const, const Gnum * restrict const, FILE * restrict const); -+ #else /* NOFILEIO */ -+ int mapSave (Gnum *, Gnum (**)[2], const Mapping * restrict const, const Gnum * restrict const, FILE * restrict const); -+ #endif /* NOFILEIO */ - int mapView (const Mapping * restrict const, const Graph * restrict const, FILE * const); - - #undef static -diff -crB scotch_5.1/src/libscotch/mapping_io.c src/src/libscotch/mapping_io.c -*** scotch_5.1/src/libscotch/mapping_io.c 2008-05-22 06:44:43.000000000 -0700 ---- src/src/libscotch/mapping_io.c 2013-05-06 14:14:20.000000000 -0700 -*************** -*** 199,204 **** ---- 199,208 ---- - - int - mapSave ( -+ #ifdef NOFILEIO -+ Gnum *pnvert, -+ Gnum (**pmaptab)[2], -+ #endif /* NOFILEIO */ - const Mapping * restrict const mappptr, - const Gnum * restrict const vlbltab, - FILE * restrict const stream) -*************** -*** 206,226 **** - const Gnum * restrict vlbltax; - Gnum vertnum; - - vlbltax = (vlbltab != NULL) ? (vlbltab - mappptr->baseval) : NULL; - - if (fprintf (stream, "%ld\n", (long) mappptr->vertnbr) == EOF) { - errorPrint ("mapSave: bad output (1)"); - return (1); - } - - for (vertnum = mappptr->baseval; vertnum < (mappptr->vertnbr + mappptr->baseval); vertnum ++) { - if (fprintf (stream, "%ld\t%ld\n", -! (long) ((vlbltax != NULL) ? vlbltax[vertnum] : vertnum), - (long) archDomNum (&mappptr->archdat, &mappptr->domntab[mappptr->parttax[vertnum]])) == EOF) { - errorPrint ("mapSave: bad output (2)"); - return (1); - } - } - - return (0); - } ---- 210,258 ---- - const Gnum * restrict vlbltax; - Gnum vertnum; - -+ #ifdef NOFILEIO -+ // printf("mapSave - stream=%p\n",stream); -+ #endif /* NOFILEIO */ - vlbltax = (vlbltab != NULL) ? (vlbltab - mappptr->baseval) : NULL; - -+ #ifndef NOFILEIO - if (fprintf (stream, "%ld\n", (long) mappptr->vertnbr) == EOF) { - errorPrint ("mapSave: bad output (1)"); - return (1); - } -+ #else /* NOFILEIO */ -+ if (pnvert) { -+ *pnvert=mappptr->vertnbr; -+ // printf("mapSave - nvert=%d\n",*pnvert); -+ } -+ if (pmaptab) { -+ *pmaptab = (Gnum (*)[2]) malloc(mappptr->vertnbr*2*sizeof(Gnum)); -+ // printf("mapSave - maptab=%p\n",*pmaptab); -+ } -+ #endif /* NOFILEIO */ - -+ #ifndef NOFILEIO - for (vertnum = mappptr->baseval; vertnum < (mappptr->vertnbr + mappptr->baseval); vertnum ++) { - if (fprintf (stream, "%ld\t%ld\n", -! /* not sure why, but need to offset vlbltax in other direction (jes, 12/11/09) */ -! // (long) ((vlbltax != NULL) ? vlbltax[vertnum] : vertnum), -! (long) ((vlbltax != NULL) ? vlbltax[vertnum+mappptr->baseval] : vertnum), - (long) archDomNum (&mappptr->archdat, &mappptr->domntab[mappptr->parttax[vertnum]])) == EOF) { - errorPrint ("mapSave: bad output (2)"); - return (1); - } - } -+ #else /* NOFILEIO */ -+ if (pmaptab && *pmaptab) -+ for (vertnum = mappptr->baseval; vertnum < (mappptr->vertnbr + mappptr->baseval); vertnum ++) { -+ /* not sure why, but need to offset vlbltax in other direction (jes, 12/11/09) */ -+ // (*pmaptab)[vertnum-mappptr->baseval][0]=((vlbltax != NULL) ? vlbltax[vertnum] : vertnum); -+ (*pmaptab)[vertnum-mappptr->baseval][0]=((vlbltax != NULL) ? vlbltax[vertnum+mappptr->baseval] : vertnum); -+ (*pmaptab)[vertnum-mappptr->baseval][1]=archDomNum (&mappptr->archdat, &mappptr->domntab[mappptr->parttax[vertnum]]); -+ // printf("mapSave - vertnum=%d; vlbltax=%d,archDomNum=%d\n", -+ // vertnum,((vlbltax != NULL) ? vlbltax[vertnum+mappptr->baseval] : -1),archDomNum (&mappptr->archdat, &mappptr->domntab[mappptr->parttax[vertnum]])); -+ } -+ #endif /* NOFILEIO */ - - return (0); - } -diff -crB scotch_5.1/src/libscotch/mesh_io_scot.c src/src/libscotch/mesh_io_scot.c -*** scotch_5.1/src/libscotch/mesh_io_scot.c 2008-05-22 06:44:43.000000000 -0700 ---- src/src/libscotch/mesh_io_scot.c 2013-05-06 14:14:20.000000000 -0700 -*************** -*** 85,91 **** ---- 85,95 ---- - int o; - - if (filesrcptr != NULL) { -+ #ifndef NOFILEIO - if (graphLoad (meshptr, filesrcptr, -1, 0) != 0) -+ #else /* NOFILEIO */ -+ if (graphLoad (meshptr, filesrcptr, -1, 0, 0, 0, NULL, NULL, NULL, NULL, NULL) != 0) -+ #endif /* NOFILEIO */ - return (1); - } - -diff -crB scotch_5.1/src/libscotch/module.h src/src/libscotch/module.h -*** scotch_5.1/src/libscotch/module.h 2009-04-26 23:07:14.000000000 -0700 ---- src/src/libscotch/module.h 2013-05-06 14:14:20.000000000 -0700 -*************** -*** 1,3 **** ---- 1,5 ---- -+ #ifndef _SCOTCH_MODULE_H_ -+ #define _SCOTCH_MODULE_H_ - /* Copyright 2004,2007-2009 ENSEIRB, INRIA & CNRS - ** - ** This file is part of the Scotch software package for static mapping, -*************** -*** 55,60 **** ---- 57,65 ---- - - #define MODULE_H - -+ /*Don't forget stdint.h:*/ -+ #include "stdint.h" -+ - /* - ** Collective communication handling. - */ -*************** -*** 156,161 **** ---- 161,167 ---- - #define intSave _SCOTCHintSave - #define intAscn _SCOTCHintAscn - #define intPerm _SCOTCHintPerm -+ #define intRandResetStatic _SCOTCHintRandResetStatic - #define intRandReset _SCOTCHintRandReset - #define intRandInit _SCOTCHintRandInit - /* #define intRandVal _SCOTCHintRandVal Already a macro */ -*************** -*** 681,683 **** ---- 687,691 ---- - #define vmeshStoreSave _SCOTCHvmeshStoreSave - #define vmeshStoreUpdt _SCOTCHvmeshStoreUpdt - #endif /* SCOTCH_RENAME */ -+ -+ #endif //#ifndef _SCOTCH_MODULE_H_ -diff -crB scotch_5.1/src/libscotch/parser_ll.l src/src/libscotch/parser_ll.l -*** scotch_5.1/src/libscotch/parser_ll.l 2008-05-22 06:44:43.000000000 -0700 ---- src/src/libscotch/parser_ll.l 2013-05-06 14:14:21.000000000 -0700 -*************** -*** 192,197 **** ---- 192,213 ---- - stratParserInit ( - const char * const string) /*+ Strategy string to parse +*/ - { -+ /* reset static variables from previous runs (jes, 4/29/10) */ -+ yy_hold_char = (char) 0; -+ yy_n_chars=0; /* number of characters read into yy_ch_buf */ -+ yy_c_buf_p = (char *) 0; -+ yy_init = 1; /* whether we need to initialize */ -+ yy_start = 0; /* start state number */ -+ yy_did_buffer_switch_on_eof=0; -+ yy_last_accepting_state=0; -+ yy_last_accepting_cpos = (char *) 0; -+ stratparserstringptr = (char *) 0; /* Pointer to the string to parse */ -+ #if YY_STACK_USED -+ yy_start_stack_ptr = 0; -+ yy_start_stack_depth = 0; -+ yy_start_stack = 0; -+ #endif -+ - #ifdef FLEX_SCANNER - yyrestart (yyin); /* (Re-)initialize the parser */ - #endif /* FLEX_SCANNER */ -diff -crB scotch_5.1/src/libscotch/parser_yy.y src/src/libscotch/parser_yy.y -*** scotch_5.1/src/libscotch/parser_yy.y 2008-10-22 15:12:48.000000000 -0700 ---- src/src/libscotch/parser_yy.y 2013-05-06 14:14:21.000000000 -0700 -*************** -*** 774,779 **** ---- 774,780 ---- - stratParserInit (string); /* Initialize the lexical parser */ - parserstrattab = strattab; /* Point to the parsing tables */ - parserstratcurr = NULL; /* Clear up the temporary strategy pointer */ -+ parserparamcurr = NULL; /* reset the last static (jes, 4/29/10) */ - - if (stratParserParse2 () != 0) { /* Parse the strategy string */ - if (parserstratcurr != NULL) -diff -crB scotch_5.1/src/libscotch/vgraph_separate_vw.c src/src/libscotch/vgraph_separate_vw.c -*** scotch_5.1/src/libscotch/vgraph_separate_vw.c 2008-05-22 06:44:43.000000000 -0700 ---- src/src/libscotch/vgraph_separate_vw.c 2013-05-06 14:14:21.000000000 -0700 -*************** -*** 83,88 **** ---- 83,89 ---- - FILE * restrict fileptr; - Gnum vertnum; /* Vertex number */ - -+ printf("vgraphSeparateVw begin -- vgraphseparatevwfilenum=%d\n",vgraphseparatevwfilenum); - sprintf (nametab, "vgraphseparatevw_output_%08d.map", vgraphseparatevwfilenum ++); - if ((fileptr = fopen (nametab, "w+")) == NULL) { - errorPrint ("vgraphSeparateVw: cannot open partition file"); -*************** -*** 102,106 **** ---- 103,108 ---- - } - } - -+ printf("vgraphSeparateVw end -- vgraphseparatevwfilenum=%d\n",vgraphseparatevwfilenum); - return (0); - } -diff -crB scotch_5.1/src/Makefile src/src/Makefile -*** scotch_5.1/src/Makefile 2008-09-15 05:50:51.000000000 -0700 ---- src/src/Makefile 2013-05-06 14:14:21.000000000 -0700 -*************** -*** 97,102 **** ---- 97,109 ---- - (cd scotch ; $(MAKE) VERSION=\"$(VERSION)\" ptscotch && $(MAKE) ptinstall) - (cd libscotchmetis ; $(MAKE) ptscotch && $(MAKE) ptinstall) - -+ nfioscotch : required -+ (cd libscotch ; $(MAKE) VERSION=\"$(VERSION)\" nfioscotch && $(MAKE) nfioinstall) -+ -+ mexscotch : required -+ (cd libscotch ; $(MAKE) VERSION=\"$(VERSION)\" mexscotch && $(MAKE) mexinstall) -+ (cd scotch ; $(MAKE) VERSION=\"$(VERSION)\" mexscotch && $(MAKE) mexinstall) -+ - install : required $(bindir) $(includedir) $(libdir) $(mandir)/man1 - -$(CP) -f ../bin/[agm]*$(EXE) $(bindir) - -$(CP) -f ../include/*scotch*.h $(includedir) -Only in src/src: Makefile.inc -diff -crB scotch_5.1/src/scotch/gmap.h src/src/scotch/gmap.h -*** scotch_5.1/src/scotch/gmap.h 2008-06-18 11:05:17.000000000 -0700 ---- src/src/scotch/gmap.h 2013-05-06 14:14:22.000000000 -0700 -*************** -*** 1,3 **** ---- 1,5 ---- -+ #ifndef _SCOTCH_GMAP_H_ -+ #define _SCOTCH_GMAP_H_ - /* Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS - ** - ** This file is part of the Scotch software package for static mapping, -*************** -*** 87,89 **** ---- 89,93 ---- - #define C_FLAGVERBSTR 0x0002 /* Verbose flags */ - #define C_FLAGVERBTIM 0x0004 - #define C_FLAGVERBMAP 0x0008 -+ -+ #endif //#ifndef _SCOTCH_GMAP_H_ -Only in src/src/scotch: gmap_mex.c -Only in src/src/scotch: gmapx.c -diff -crB scotch_5.1/src/scotch/Makefile src/src/scotch/Makefile -*** scotch_5.1/src/scotch/Makefile 2009-04-27 02:19:43.000000000 -0700 ---- src/src/scotch/Makefile 2013-05-06 14:14:22.000000000 -0700 -*************** -*** 49,59 **** - %$(EXE) : %.c - $(CC) $(CFLAGS) -I$(includedir) -I../libscotch -DSCOTCH_VERSION=\"$(VERSION)\" $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS) - - ## - ## Project rules. - ## - -! .PHONY : ptscotch scotch ptinstall install clean realclean - - scotch : clean - $(MAKE) CC="$(CCS)" SCOTCHLIB=scotch \ ---- 49,62 ---- - %$(EXE) : %.c - $(CC) $(CFLAGS) -I$(includedir) -I../libscotch -DSCOTCH_VERSION=\"$(VERSION)\" $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS) - -+ %$(MEX) : %.c -+ $(CCM) $(MFLAGS) -I$(includedir) -I../libscotch -DSCOTCH_VERSION=\"$(VERSION)\" $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS) -+ - ## - ## Project rules. - ## - -! .PHONY : ptscotch scotch mexscotch ptinstall install mexinstall clean realclean - - scotch : clean - $(MAKE) CC="$(CCS)" SCOTCHLIB=scotch \ -*************** -*** 94,99 **** ---- 97,108 ---- - dgscat$(EXE) \ - dgtst$(EXE) - -+ mexscotch : clean -+ $(MAKE) CFLAGS="$(CFLAGS) -DNOFILEIO -DMATLAB -I${MATLAB_DIR}/extern/include" CC="$(CCS)" CCD="$(CCS)" LDFLAGS="$(LDFLAGS) -Wl,-rpath-link,${MATLAB_DIR}/bin/glnxa64 -L${MATLAB_DIR}/bin/glnxa64 -lmex -lmat" SCOTCHLIB=mexscotch \ -+ gmapx$(OBJ) -+ $(MAKE) CFLAGS="$(CFLAGS) -DNOFILEIO -DMATLAB -I${MATLAB_DIR}/extern/include" CC="$(CCS)" LDFLAGS="$(LDFLAGS) -Wl,-rpath-link,${MATLAB_DIR}/bin/glnxa64 -L${MATLAB_DIR}/bin/glnxa64 -lmex -lmat gmapx$(OBJ)" SCOTCHLIB=mexscotch \ -+ gmap_mex$(MEX) -+ - install : - -$(CP) acpl$(EXE) amk_ccc$(EXE) amk_fft2$(EXE) amk_grf$(EXE) amk_hy$(EXE) amk_m2$(EXE) amk_p2$(EXE) atst$(EXE) gbase$(EXE) gcv$(EXE) gmap$(EXE) gmk_hy$(EXE) gmk_m2$(EXE) gmk_m3$(EXE) gmk_msh$(EXE) gmk_ub2$(EXE) gmtst$(EXE) gord$(EXE) gotst$(EXE) gout$(EXE) *gtst$(EXE) gscat$(EXE) mcv$(EXE) mmk_m2$(EXE) mmk_m3$(EXE) mord$(EXE) mtst$(EXE) $(bindir) - -$(RM) $(bindir)/gpart$(EXE) -*************** -*** 104,111 **** ---- 113,126 ---- - -$(RM) $(bindir)/dgpart$(EXE) - -$(LN) $(bindir)/dgmap$(EXE) $(bindir)/dgpart$(EXE) - -+ mexinstall : -+ -$(CP) gmap_mex$(MEX) $(bindir) -+ -$(RM) $(bindir)/gpart_mex$(MEX) -+ -$(LN) $(bindir)/gmap_mex$(MEX) $(bindir)/gpart_mex$(MEX) -+ - clean : - -$(RM) *~ *$(OBJ) acpl$(EXE) amk_ccc$(EXE) amk_fft2$(EXE) amk_grf$(EXE) amk_hy$(EXE) amk_m2$(EXE) amk_p2$(EXE) atst$(EXE) gbase$(EXE) gcv$(EXE) *gmap$(EXE) gmk_hy$(EXE) gmk_m2$(EXE) gmk_m3$(EXE) gmk_msh$(EXE) gmk_ub2$(EXE) gmtst$(EXE) *gord$(EXE) gotst$(EXE) gout$(EXE) *gpart$(EXE) *gscat$(EXE) *gtst$(EXE) mcv$(EXE) mmk_m2$(EXE) mmk_m3$(EXE) mord$(EXE) mtst$(EXE) -+ -$(RM) gmap_mex$(MEX) - - realclean : clean - -*************** -*** 365,367 **** ---- 380,403 ---- - $(libdir)/libscotch$(LIB) \ - $(libdir)/libscotcherrexit$(LIB) \ - mtst.h -+ -+ gmapx$(OBJ) : gmapx.c \ -+ ../libscotch/module.h \ -+ ../libscotch/common.h \ -+ $(includedir)/scotch.h \ -+ $(libdir)/libmexscotch$(LIB) \ -+ $(libdir)/libmexscotcherrexit$(LIB) \ -+ gmap.h -+ -+ gmap_mex$(MEX) : gmap_mex.c \ -+ ../libscotch/module.h \ -+ ../libscotch/common.h \ -+ $(includedir)/scotch.h \ -+ $(libdir)/libmexscotch$(LIB) \ -+ $(libdir)/libmexscotcherrexit$(LIB) \ -+ gmap.h -+ -+ gpart_mex$(MEX) : gmap_mex$(MEX) -+ -$(RM) gpart_mex$(MEX) -+ -$(LN) gmap_mex$(MEX) gpart_mex$(MEX) -+ diff --git a/externalpackages/scotch/scotch_README.txt b/externalpackages/scotch/scotch_README.txt deleted file mode 100644 index 253ee5436..000000000 --- a/externalpackages/scotch/scotch_README.txt +++ /dev/null @@ -1,296 +0,0 @@ -8/06/09: - -following INSTALL.txt: -- GNU Make 3.81, lex, yacc all present - - -[jschierm@astrid src]$ diff Makefile_old.inc Makefile.inc - -- started with Makefile.inc.i686_sun_solaris5 -- changed CCS from cc to gcc -- removed SCOTCH_PTHREAD, since MPICH2 1.0.2p1 is prior to 1.0.7 -- added -std=c99 to CFLAGS for "restrict" attribute (based on various internet pages) -- added -DCOMMON_TIMING_OLD to CFLAGS for undeclared CLOCK_REALTIME (based on common2.c) -- added MEX, CCM, and MFLAGS for Matlab mex modules (as well as Matlab libraries and -largeArrayDims) -- removed -DCOMMON_PTHREAD from CFLAGS and MFLAGS to eliminate fatal exception at pthread_exit in gmap_mex.c -- removed -DCOMMON_FILE_COMPRESS_GZ from CFLAGS and MFLAGS since gzip not used -- added -Wl,-rpath-link,/usr/local/pkgs/matlab-7.6/bin/glnxa64 to LDFLAGS to eliminate missing libhdf5.so.0 in Matlab directories (based on Cielo make) - -3a4 -> MEX = .mexa64 -12,13c13,16 -< CFLAGS = -m64 -O3 -std=c99 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DINTSIZE64 -Dintptr_t="long int" -DCOMMON_TIMING_OLD -< LDFLAGS = -lz -lm -lrt ---- -> CCM = mex -> CFLAGS = -m64 -O3 -std=c99 -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -DMATLAB -fPIC -I/usr/local/pkgs/matlab-7.6/extern/include -> LDFLAGS = -lz -lm -lrt -Wl,-rpath-link,/usr/local/pkgs/matlab-7.6/bin/glnxa64 -L/usr/local/pkgs/matlab-7.6/bin/glnxa64 -lmex -lmat -> MFLAGS = -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DCOMMON_TIMING_OLD -DMATLAB -I/usr/local/pkgs/matlab-7.6/extern/include -largeArrayDims - - -[jschierm@astrid libscotch]$ diff common_old.c common.c - -- redirect usagePrint to within Matlab -102a103 -> #ifndef MATLAB -105a107,111 -> #else /* MATLAB */ -> mexPrintf ("Usage is:\n"); -> for (cptr = data; *cptr != NULL; cptr ++) -> mexPrintf (" %s\n", *cptr); -> #endif /* MATLAB */ - - -[jschierm@astrid libscotch]$ diff common_old.h common.h - -- fix undeclared type intptr_t -68a69 -> #include /* added for intptr_t */ - -- for running as a matlab mex function -- add macro for fprintf to capture missing output -- fix exits to exit within Matlab -90a92,105 -> #ifdef MATLAB -> #include "mat.h" -> #include "mex.h" -> #include "matrix.h" -> -> #define printf mexPrintf -> #define fprintf(file,...) (file == stdout || file == stderr ? mexPrintf(__VA_ARGS__) : fprintf(file,__VA_ARGS__)) -> #define malloc mxMalloc -> #define calloc mxCalloc -> #define realloc mxRealloc -> #define free mxFree -> #define exit(status) mexErrMsgTxt("exit=" #status) -> #endif -> - - -[jschierm@astrid libscotch]$ diff dummysizes_old.c dummysizes.c - -- dummysizes must run by itself during compilation and exit cleanly -269a270 -> #ifndef MATLAB -270a272 -> #endif /* MATLAB */ - - -[jschierm@astrid libscotch]$ diff library_error_exit_old.c library_error_exit.c - -- redirect errorPrint and errorPrintW to within Matlab -116a117 -> #ifndef MATLAB -133a135,152 -> #else /* MATLAB */ -> mexPrintf ("%s", _SCOTCHerrorProgName); -> #ifdef SCOTCH_PTSCOTCH -> if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) && -> (proclocnum != 0) && -> (MPI_Comm_rank (MPI_COMM_WORLD, &proclocnum) == MPI_SUCCESS)) -> mexPrintf ("(%d): ", proclocnum); -> #else /* SCOTCH_PTSCOTCH */ -> if (_SCOTCHerrorProgName[0] != '\0') -> mexPrintf (": "); -> #endif /* SCOTCH_PTSCOTCH */ -> mexPrintf ("ERROR: "); -> va_start (errlist, errstr); -> mexPrintf (errstr, errlist); /* Print arguments */ -> va_end (errlist); -> mexPrintf ("\n"); -> #endif /* MATLAB */ -> -157a177 -> #ifndef MATLAB -173a194,211 -> -> #else /* MATLAB */ -> mexPrintf ("%s", _SCOTCHerrorProgName); -> #ifdef SCOTCH_PTSCOTCH -> if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) && -> (proclocnum != 0) && -> (MPI_Comm_rank (MPI_COMM_WORLD, &proclocnum) == MPI_SUCCESS)) -> mexPrintf ("(%d): ", proclocnum); -> #else /* SCOTCH_PTSCOTCH */ -> if (_SCOTCHerrorProgName[0] != '\0') -> mexPrintf (": "); -> #endif /* SCOTCH_PTSCOTCH */ -> mexPrintf ("WARNING: "); -> va_start (errlist, errstr); -> mexPrintf (errstr, errlist); /* Print arguments */ -> va_end (errlist); -> mexPrintf ("\n"); -> #endif /* MATLAB */ - - -[jschierm@astrid scotch]$ diff Makefile_old Makefile -- add MEX rule -- add gmap_mex into scotch, clean, and install rules -- add gmap_mex object -51a52,54 -> %$(MEX) : %.c -> $(CCM) $(MFLAGS) -I$(includedir) -I../libscotch -DSCOTCH_VERSION=\"$(VERSION)\" $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS) -> -70a74 -> gmap_mex$(MEX) \ -98c102 -< -$(CP) acpl$(EXE) amk_ccc$(EXE) amk_fft2$(EXE) amk_grf$(EXE) amk_hy$(EXE) amk_m2$(EXE) amk_p2$(EXE) atst$(EXE) gbase$(EXE) gcv$(EXE) gmap$(EXE) gmk_hy$(EXE) gmk_m2$(EXE) gmk_m3$(EXE) gmk_msh$(EXE) gmk_ub2$(EXE) gmtst$(EXE) gord$(EXE) gotst$(EXE) gout$(EXE) *gtst$(EXE) gscat$(EXE) mcv$(EXE) mmk_m2$(EXE) mmk_m3$(EXE) mord$(EXE) mtst$(EXE) $(bindir) ---- -> -$(CP) acpl$(EXE) amk_ccc$(EXE) amk_fft2$(EXE) amk_grf$(EXE) amk_hy$(EXE) amk_m2$(EXE) amk_p2$(EXE) atst$(EXE) gbase$(EXE) gcv$(EXE) gmap$(EXE) gmap_mex$(MEX) gmk_hy$(EXE) gmk_m2$(EXE) gmk_m3$(EXE) gmk_msh$(EXE) gmk_ub2$(EXE) gmtst$(EXE) gord$(EXE) gotst$(EXE) gout$(EXE) *gtst$(EXE) gscat$(EXE) mcv$(EXE) mmk_m2$(EXE) mmk_m3$(EXE) mord$(EXE) mtst$(EXE) $(bindir) -108c112 -< -$(RM) *~ *$(OBJ) acpl$(EXE) amk_ccc$(EXE) amk_fft2$(EXE) amk_grf$(EXE) amk_hy$(EXE) amk_m2$(EXE) amk_p2$(EXE) atst$(EXE) gbase$(EXE) gcv$(EXE) *gmap$(EXE) gmk_hy$(EXE) gmk_m2$(EXE) gmk_m3$(EXE) gmk_msh$(EXE) gmk_ub2$(EXE) gmtst$(EXE) *gord$(EXE) gotst$(EXE) gout$(EXE) *gpart$(EXE) *gscat$(EXE) *gtst$(EXE) mcv$(EXE) mmk_m2$(EXE) mmk_m3$(EXE) mord$(EXE) mtst$(EXE) ---- -> -$(RM) *~ *$(OBJ) acpl$(EXE) amk_ccc$(EXE) amk_fft2$(EXE) amk_grf$(EXE) amk_hy$(EXE) amk_m2$(EXE) amk_p2$(EXE) atst$(EXE) gbase$(EXE) gcv$(EXE) *gmap$(EXE) gmap_mex$(MEX) gmk_hy$(EXE) gmk_m2$(EXE) gmk_m3$(EXE) gmk_msh$(EXE) gmk_ub2$(EXE) gmtst$(EXE) *gord$(EXE) gotst$(EXE) gout$(EXE) *gpart$(EXE) *gscat$(EXE) *gtst$(EXE) mcv$(EXE) mmk_m2$(EXE) mmk_m3$(EXE) mord$(EXE) mtst$(EXE) -239a244,251 -> gmap_mex$(MEX) : gmap_mex.c \ -> ../libscotch/module.h \ -> ../libscotch/common.h \ -> $(includedir)/scotch.h \ -> $(libdir)/libscotch$(LIB) \ -> $(libdir)/libscotcherrexit$(LIB) \ -> gmap.h -> - - -[jschierm@astrid scotch]$ diff gmap.c gmap_mex.c -- convert gmap to gmap_mex mex function with variable argument list -117,120c117,120 -< int -< main ( -< int argc, -< char * argv[]) ---- -> void mexFunction( int nlhs, -> mxArray *plhs[], -> int nrhs, -> const mxArray *prhs[] ) -121a122,123 -> int argcm; -> char argvm[21][257]; -130a133,152 -> /* check static variables from previous runs */ -> -> if (C_paraNum > 0 || C_fileNum > 0) -> mexErrMsgTxt("gmap_mex still in memory -- clear gmap_mex and try again.\n"); -> -> /* load matlab argument list */ -> -> argcm=nrhs+1; -> mexPrintf("argcm=%d\n",argcm); -> strcpy(argvm[0],"gmap"); -> for (i=0; i if (!mxIsChar(prhs[i])) { -> mexPrintf("%s -- prhs[%d] must be character.\n","gmap",i); -> mexErrMsgTxt(" "); -> } -> else -> mxGetString(prhs[i],argvm[i+1],256); -> for (i=0; i mexPrintf("argvm[%d]=%s\n",i,argvm[i]); -> -132,133c154,155 -< i = strlen (argv[0]); -< if ((i >= 5) && (strncmp (argv[0] + i - 5, "gpart", 5) == 0)) { ---- -> i = strlen (argvm[0]); -> if ((i >= 5) && (strncmp (argvm[0] + i - 5, "gpart", 5) == 0)) { -144c166 -< if ((argc >= 2) && (argv[1][0] == '?')) { /* If need for help */ ---- -> if ((argcm >= 2) && (argvm[1][0] == '?')) { /* If need for help */ -151a174,175 -> printf("point 0: C_FILENBR=%d, C_fileNbr=%d, C_paraNbr=%d\n", -> C_FILENBR,C_fileNbr,C_paraNbr); -154,155c178,183 -< for (i = 1; i < argc; i ++) { /* Loop for all option codes */ -< if ((argv[i][0] != '-') || (argv[i][1] == '\0') || (argv[i][1] == '.')) { /* If found a file name */ ---- -> for (i = 1; i < argcm; i ++) { /* Loop for all option codes */ -> printf("point 1: i=%d; C_fileNbr=%d, C_fileNum=%d, C_paraNbr=%d, C_paraNum=%d\n", -> i,C_fileNbr,C_fileNum,C_paraNbr,C_paraNum); -> if ((argvm[i][0] != '-') || (argvm[i][1] == '\0') || (argvm[i][1] == '.')) { /* If found a file name */ -> printf("point 2: i=%d; C_fileNbr=%d, C_fileNum=%d, C_paraNbr=%d, C_paraNum=%d\n", -> i,C_fileNbr,C_fileNum,C_paraNbr,C_paraNum); -157,158c185,186 -< if ((C_partNbr = atoi (argv[i])) < 1) /* Get the number of parts */ -< errorPrint ("main: invalid number of parts (\"%s\")", argv[i]); ---- -> if ((C_partNbr = atoi (argvm[i])) < 1) /* Get the number of parts */ -> errorPrint ("main: invalid number of parts (\"%s\")", argvm[i]); -161a190,191 -> printf("point 3: i=%d; C_fileNbr=%d, C_fileNum=%d, C_paraNbr=%d, C_paraNum=%d\n", -> i,C_fileNbr,C_fileNum,C_paraNbr,C_paraNum); -163c193 -< C_fileTab[C_fileNum ++].name = argv[i]; ---- -> C_fileTab[C_fileNum ++].name = argvm[i]; -165a196,197 -> printf("point 4: i=%d; C_fileNbr=%d, C_fileNum=%d, C_paraNbr=%d, C_paraNum=%d\n", -> i,C_fileNbr,C_fileNum,C_paraNbr,C_paraNum); -168c200 -< switch (argv[i][1]) { ---- -> switch (argvm[i][1]) { -177c209 -< SCOTCH_stratGraphMap (&stradat, &argv[i][2]); ---- -> SCOTCH_stratGraphMap (&stradat, &argvm[i][2]); -181,182c213,214 -< for (j = 2; argv[i][j] != '\0'; j ++) { -< switch (argv[i][j]) { ---- -> for (j = 2; argvm[i][j] != '\0'; j ++) { -> switch (argvm[i][j]) { -192c224 -< errorPrint ("main: invalid source graph option (\"%c\")", argv[i][j]); ---- -> errorPrint ("main: invalid source graph option (\"%c\")", argvm[i][j]); -202,203c234,235 -< for (j = 2; argv[i][j] != '\0'; j ++) { -< switch (argv[i][j]) { ---- -> for (j = 2; argvm[i][j] != '\0'; j ++) { -> switch (argvm[i][j]) { -217c249 -< errorPrint ("main: unprocessed parameter \"%c\" in \"%s\"", argv[i][j], argv[i]); ---- -> errorPrint ("main: unprocessed parameter \"%c\" in \"%s\"", argvm[i][j], argvm[i]); -222c254 -< errorPrint ("main: unprocessed option (\"%s\")", argv[i]); ---- -> errorPrint ("main: unprocessed option (\"%s\")", argvm[i]); -225a258 -> printf("point 5\n"); -230a264 -> printf("point 6\n"); -232a267 -> printf("point 7\n"); -235a271 -> printf("point 8\n"); -239a276 -> printf("point 9\n"); -244a282 -> printf("point 10\n"); -251a290 -> printf("point 11\n"); -256a296 -> printf("point 12\n"); -264a305 -> printf("point 13\n"); -271a313 -> printf("point 14\n"); -273a316 -> printf("point 15\n"); -276a320 -> printf("point 16\n"); -277a322 -> printf("point 16a\n"); -278a324 -> printf("point 16b\n"); -279a326 -> printf("point 16c\n"); -280a328 -> printf("point 17\n"); -284a333 -> printf("point 18\n"); - diff --git a/externalpackages/scotch/scotch_jes_notes.txt b/externalpackages/scotch/scotch_jes_notes.txt deleted file mode 100644 index 45fd84aac..000000000 --- a/externalpackages/scotch/scotch_jes_notes.txt +++ /dev/null @@ -1,308 +0,0 @@ -8/06/09: - -following INSTALL.txt: -- GNU Make 3.81, lex, yacc all present -- started with Makefile.inc.i686_sun_solaris5 -- changed CCS from cc to gcc -- removed SCOTCH_PTHREAD, since MPICH2 1.0.2p1 is prior to 1.0.7 - -graph.h:110: error: expected :, ,, ;, ) or __attribute__ before vnumtab -(and so on for "restrict" attribute in graph.h,geom.h,mesh.h,arch.h,mapping.h,order.h) -- added -std=c99 to CFLAGS (based on various internet pages) - -bgraph_bipart_gg.c:267: error: intptr_t undeclared -- according to various internet pages, should be included in c99 standard -- defined in /usr/include/stdint.h (also referenced in inttypes.h), so why not included? -- added -DINTSIZE64 to CFLAGS, still didn't work (based on INSTALL.txt) -- added -Dintptr_t="long int" (based on /usr/include/stdint.h) - -common2.c:764: error: storage size of tp isn't known -common2.c:766: error: CLOCK_REALTIME undeclared -- added -DCOMMON_TIMING_OLD to CFLAGS (based on source code) - -8/13/09: - -for running as a matlab mex function: -[jschierm@astrid libscotch]$ diff common_old.h common.h -90a91,102 -> #ifdef MATLAB -> #include "mat.h" -> #include "mex.h" -> #include "matrix.h" -> -> #define printf mexPrintf -> #define malloc mxMalloc -> #define calloc mxCalloc -> #define realloc mxRealloc -> #define free mxFree -> #endif -> - -[jschierm@astrid src]$ diff Makefile_old.inc Makefile.inc -12,13c12,13 -< CFLAGS = -m64 -O3 -std=c99 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DINTSIZE64 -Dintptr_t="long int" -DCOMMON_TIMING_OLD -< LDFLAGS = -lz -lm -lrt ---- -> CFLAGS = -m64 -O3 -std=c99 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Du_int32_t=uint32_t -Du_int64_t=uint64_t -DINTSIZE64 -Dintptr_t="long int" -DCOMMON_TIMING_OLD -DMATLAB -fPIC -I/usr/local/pkgs/matlab-7.6/extern/include -> LDFLAGS = -lz -lm -lrt -L/usr/local/pkgs/matlab-7.6/bin/glnxa64 -lmat -lmex - -8/19/09: - -- still having problems with intptr_t: -gcc: int: No such file or directory -In file included from ../libscotch/common.h:81, - from gmap_mex.c:75: -/usr/include/unistd.h:238: error: two or more data types in declaration specifiers -- removed -DINTSIZE64 and -Dintptr_t="long int" from CFLAGS above -[jschierm@astrid libscotch]$ diff common_old.h common.h -68a69 -> #include /* added for intptr_t */ - -8/20/09: - -- must fix exits to exit within Matlab: -[jschierm@astrid libscotch]$ diff common_old.h common.h -68a69 -> #include /* added for intptr_t */ -90a92,104 -> #ifdef MATLAB -> #include "mat.h" -> #include "mex.h" -> #include "matrix.h" -> -> #define printf mexPrintf -> #define malloc mxMalloc -> #define calloc mxCalloc -> #define realloc mxRealloc -> #define free mxFree -> #define exit(status) mexErrMsgTxt("exit=" #status) -> #endif -> - -- however, dummysizes must run by itself during compilation and exit cleanly: -[jschierm@astrid libscotch]$ diff dummysizes_old.c dummysizes.c -269a270 -> #ifndef MATLAB -270a272 -> #endif /* MATLAB */ - -- redirect errorPrint and errorPrintW to within Matlab: -[jschierm@astrid libscotch]$ diff library_error_exit_old.c -library_error_exit.c -116a117 -> #ifndef MATLAB -133a135,152 -> #else /* MATLAB */ -> mexPrintf ("%s", _SCOTCHerrorProgName); -> #ifdef SCOTCH_PTSCOTCH -> if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) && -> (proclocnum != 0) && -> (MPI_Comm_rank (MPI_COMM_WORLD, &proclocnum) == MPI_SUCCESS)) -> mexPrintf ("(%d): ", proclocnum); -> #else /* SCOTCH_PTSCOTCH */ -> if (_SCOTCHerrorProgName[0] != '\0') -> mexPrintf (": "); -> #endif /* SCOTCH_PTSCOTCH */ -> mexPrintf ("ERROR: "); -> va_start (errlist, errstr); -> mexPrintf (errstr, errlist); /* Print arguments */ -> va_end (errlist); -> mexPrintf ("\n"); -> #endif /* MATLAB */ -> -157a177 -> #ifndef MATLAB -173a194,211 -> -> #else /* MATLAB */ -> mexPrintf ("%s", _SCOTCHerrorProgName); -> #ifdef SCOTCH_PTSCOTCH -> if ((MPI_Initialized (&proclocnum) == MPI_SUCCESS) && -> (proclocnum != 0) && -> (MPI_Comm_rank (MPI_COMM_WORLD, &proclocnum) == MPI_SUCCESS)) -> mexPrintf ("(%d): ", proclocnum); -> #else /* SCOTCH_PTSCOTCH */ -> if (_SCOTCHerrorProgName[0] != '\0') -> mexPrintf (": "); -> #endif /* SCOTCH_PTSCOTCH */ -> mexPrintf ("WARNING: "); -> va_start (errlist, errstr); -> mexPrintf (errstr, errlist); /* Print arguments */ -> va_end (errlist); -> mexPrintf ("\n"); -> #endif /* MATLAB */ - -- redirect usagePrint to within Matlab: -[jschierm@astrid libscotch]$ diff common_old.c common.c -102a103 -> #ifndef MATLAB -105a107,111 -> #else /* MATLAB */ -> mexPrintf ("Usage is:\n"); -> for (cptr = data; *cptr != NULL; cptr ++) -> mexPrintf (" %s\n", *cptr); -> #endif /* MATLAB */ - -8/21/09: - -- removed -DCOMMON_PTHREAD from CFLAGS and MFLAGS to eliminate fatal exception at pthread_exit in gmap_mex.c -- removed -DCOMMON_FILE_COMPRESS_GZ from CFLAGS and MFLAGS because unused - -8/25/09: - -added macro for fprintf to capture missing output: -[jschierm@astrid libscotch]$ diff common_old.h common.h -68a69 -> #include /* added for intptr_t */ -90a92,105 -> #ifdef MATLAB -> #include "mat.h" -> #include "mex.h" -> #include "matrix.h" -> -> #define printf mexPrintf -> #define fprintf(file,...) (file == stdout || file == stderr ? mexPrintf(__VA_ARGS__) : fprintf(file,__VA_ARGS__)) -> #define malloc mxMalloc -> #define calloc mxCalloc -> #define realloc mxRealloc -> #define free mxFree -> #define exit(status) mexErrMsgTxt("exit=" #status) -> #endif -> - -11/12/09: - -- added -Wl,-rpath-link,/usr/local/pkgs/matlab-7.6/bin/glnxa64 to LDFLAGS to eliminate missing libhdf5.so.0 in Matlab directories (based on Cielo make, but why did this not occur before?) - -11/18/09: - -- changed the following files to allow adjir,adjjc,vertlab,vertwgt,edgewgt rather than graph file - -libscotch/library.h -- argument list for SCOTCH_graphLoad -libscotch/library_graph.c -- SCOTCH_graphLoad changes and call to graphLoad -libscotch/graph.h -- argument list for graphLoad -libscotch/graph_io.c -- graphLoad changes -libscotch/graph_io_scot.c -- miscellaneous call to graphLoad -libscotch/mesh_io_scot.c -- miscellaneous call to graphLoad -libscotch/library_graph_f.c -- miscellaneous call to SCOTCH_graphLoad -scotch/gmap_mex.c -- input/processing of Matlab arguments and call to SCOTCH_graphLoad - -11/30/09: - -- changed the following files to allow nvert,maptab rather than map file - -libscotch/library.h -- argument list for SCOTCH_graphMapSave -libscotch/library_graph_map.c -- SCOTCH_graphMapSave changes and call to mapSave -libscotch/mapping.h -- argument list for mapSave -libscotch/mapping_io.c -- mapSave changes -libscotch/library_graph_map_f.c -- miscellaneous call to SCOTCH_graphMapSave -scotch/gmap_mex.c -- call to SCOTCH_graphMapSave and processing/output of Matlab arguments - -12/08/09: - -- changed the following files to allow archtyp,napar,archpar rather than target file - -libscotch/library.h -- argument list for SCOTCH_archLoad -libscotch/library_arch.c -- SCOTCH_archLoad changes and call to archLoad -libscotch/arch.h -- argument list for archLoad -libscotch/arch.c -- archLoad changes and call to class->archLoad -libscotch/arch_cmplt.h -libscotch/arch_cmpltw.h -libscotch/arch_deco.h -libscotch/arch_hcub.h -libscotch/arch_mesh.h -libscotch/arch_tleaf.h -libscotch/arch_torus.h -- argument lists for arch*ArchLoad -libscotch/arch_cmplt.c -libscotch/arch_cmpltw.c -libscotch/arch_deco.c -libscotch/arch_hcub.c -libscotch/arch_mesh.c -libscotch/arch_tleaf.c -libscotch/arch_torus.c -- arch*ArchLoad changes -libscotch/library_arch_f.c -- miscellaneous call to SCOTCH_archLoad -scotch/gmap_mex.c -- input/processing of Matlab arguments and call to SCOTCH_archLoad - -12/11/09: - -- fixed a couple bugs - -libscotch/graph.c -- caused crash when trying to free vertex labels -138c138,141 -< if (grafptr->vlbltax != NULL) ---- -> /* vlbltax must also check GRAPHVERTGROUP (jes, 12/11/09) */ -> // if (grafptr->vlbltax != NULL) -> if ((grafptr->vlbltax != NULL) && -> ((grafptr->flagval & GRAPHVERTGROUP) == 0)) - -libscotch/mapping_io.c -- caused first vertex label to be uninitialized -> /* not sure why, but need to offset vlbltax in other direction (jes, 12/11/09 -> // (long) ((vlbltax != NULL) ? vlbltax[vertnum] : vertnum), -> (long) ((vlbltax != NULL) ? vlbltax[vertnum+mappptr->baseva - -1/05/10: - -libscotch/graph_io.c -- if vertex labels are supplied, they must be referenced -263c265,268 -< edgeval=adjir[edgenum-grafptr->baseval]+1; ---- -> if (vertlab) -> edgeval=vertlab[adjir[edgenum-grafptr->baseval] ]; -> else -> edgeval= adjir[edgenum-grafptr->baseval]+1; - -2/08/10: - -- modified all source code changes to use the MATLAB compiler conditional, so that both mex and stand-alone modules could be built simultaneously - -2/10/10: - -- added mexscotch target to makefiles to separate mex from stand-alone modules -- removed Matlab-specific switches from CFLAGS and LDFLAGS and added them to mexscotch target - -3/03/10: - -- separated dummysizes within mexscotch target in libscotch/Makefile so that it is built without the matlab flag, includes, and libraries (matlab 7.8 would fail even though matlab 7.6 was okay). - -4/26/10: - -- separated gmap_mex.c driver into gmap_mex.c matlab-layer (independent of scotch) and gmapx.c x-layer (independent of matlab). - -4/29/10: - -- made changes to gmapx.c, parser_yy.y/stratParserParse, and parser_ll.l/stratParserInit to reset static variables from previous runs. -- inserted print statements into common_integer.c/intRand*, common_memory.c/mem*, and vgraph_separate_vw.c/vgraphSeparateVw to monitor static variables in case those have to be reset. - -5/03/10: - -- implemented gpart functionality in gmap_mex.c, gmapx.c, and new gpart.m. -- implemented common_integer.c/intRandResetStatic to reset static variables from previous runs. - -6/16/10: - -- renamed scotch x-layer and separated it from rest of build. -- set up scotch to build both stand-alone and mex libraries. - diff --git a/externalpackages/shapelib/install.sh b/externalpackages/shapelib/install.sh deleted file mode 100755 index bfd3c65b2..000000000 --- a/externalpackages/shapelib/install.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -set -eu - -# Some cleanup -rm -rf shapelib-1.2.10 -rm -rf src -rm -rf install -mkdir src install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/shapelib-1.2.10.tar.gz' 'shapelib-1.2.10.tar.gz' -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/shape_eg_data.zip' 'shape_eg_data.zip' -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/docs/shapefile.pdf' 'shapefile.pdf' - -# Untar -tar -xvzf shapelib-1.2.10.tar.gz -unzip shape_eg_data.zip -d shapelib-1.2.10/eg_data - -# Move shapelib to src directory -mv shapelib-1.2.10/* src -rm -rf shapelib-1.2.10 - -# Apply patches (all at once) -# (written by diff -rc old_src new_src > shapelib.patch) -patch -p0 < shapelib.patch - -# Build shapelib and run self-tests -cd src -if [ $# -eq 0 ]; then - make -else - make -j $1 -fi -make test - -# Clean up objects (but not library or executable) -#make clean -cd .. - -# Populate install directory -cp -p src/README install -cp -p src/*.html install -mkdir install/include -cp -p src/shapefil.h install/include -mkdir install/lib -mv src/libshape.a install/lib/libshape.a -mkdir install/exec -mv src/shpcreate install/exec -mv src/shpadd install/exec -mv src/shpdump install/exec -mv src/shprewind install/exec -mv src/dbfcreate install/exec -mv src/dbfadd install/exec -mv src/dbfdump install/exec -mv src/shputils install/exec -mv src/shptest install/exec diff --git a/externalpackages/shapelib/shapelib.patch b/externalpackages/shapelib/shapelib.patch deleted file mode 100644 index 4f5bfa3ec..000000000 --- a/externalpackages/shapelib/shapelib.patch +++ /dev/null @@ -1,139 +0,0 @@ -diff -rc src/Makefile src_new/Makefile -*** src/Makefile 2003-04-07 06:03:22.000000000 -0700 ---- src_new/Makefile 2011-10-19 11:58:13.993411828 -0700 -*************** -*** 1,20 **** - - #LINKOPT = /usr/local/lib/libdbmalloc.a -! CFLAGS = -g - - default: all - -! all: shpcreate shpadd shpdump shprewind dbfcreate dbfadd dbfdump shptest - - shpopen.o: shpopen.c shapefil.h - $(CC) $(CFLAGS) -c shpopen.c - -- shptree.o: shptree.c shapefil.h -- $(CC) $(CFLAGS) -c shptree.c -- - dbfopen.o: dbfopen.c shapefil.h - $(CC) $(CFLAGS) -c dbfopen.c - - shpcreate: shpcreate.c shpopen.o - $(CC) $(CFLAGS) shpcreate.c shpopen.o $(LINKOPT) -o shpcreate - ---- 1,24 ---- - - #LINKOPT = /usr/local/lib/libdbmalloc.a -! CC = gcc -! #CFLAGS = -g -! CFLAGS = -fPIC -fno-omit-frame-pointer -pthread -fexceptions -g -! AR = /usr/bin/ar rcv -! RANLIB = /usr/bin/ranlib - - default: all - -! all: libshape.a shpcreate shpadd shpdump shprewind dbfcreate dbfadd dbfdump shputils shptest - - shpopen.o: shpopen.c shapefil.h - $(CC) $(CFLAGS) -c shpopen.c - - dbfopen.o: dbfopen.c shapefil.h - $(CC) $(CFLAGS) -c dbfopen.c - -+ libshape.a: shpopen.o dbfopen.o -+ ${AR} libshape.a shpopen.o dbfopen.o ; ${RANLIB} libshape.a -+ - shpcreate: shpcreate.c shpopen.o - $(CC) $(CFLAGS) shpcreate.c shpopen.o $(LINKOPT) -o shpcreate - -*************** -*** 36,58 **** - dbfdump: dbfdump.c dbfopen.o - $(CC) $(CFLAGS) dbfdump.c dbfopen.o $(LINKOPT) -o dbfdump - - shptest: shptest.c shpopen.o - $(CC) $(CFLAGS) shptest.c shpopen.o $(LINKOPT) -o shptest - -! shputils: shputils.c shpopen.o dbfopen.o -! $(CC) $(CFLAGS) shputils.c shpopen.o dbfopen.o $(LINKOPT) -o shputils - - shptreedump: shptreedump.c shptree.o shpopen.o - $(CC) $(CFLAGS) shptreedump.c shptree.o shpopen.o $(LINKOPT) \ - -o shptreedump - - clean: -! rm -f *.o dbfdump dbfcreate dbfadd shpdump shpcreate shpadd shputils - rm -f shptreedump - rm -rf *.lo *.la .libs -- rm -f shptest - -! test: test2 test3 - - # - # Note this stream only works if example data is accessable. ---- 40,64 ---- - dbfdump: dbfdump.c dbfopen.o - $(CC) $(CFLAGS) dbfdump.c dbfopen.o $(LINKOPT) -o dbfdump - -+ shputils: shputils.c shpopen.o dbfopen.o -+ $(CC) $(CFLAGS) shputils.c shpopen.o dbfopen.o $(LINKOPT) -o shputils -+ - shptest: shptest.c shpopen.o - $(CC) $(CFLAGS) shptest.c shpopen.o $(LINKOPT) -o shptest - -! shptree.o: shptree.c shapefil.h -! $(CC) $(CFLAGS) -c shptree.c - - shptreedump: shptreedump.c shptree.o shpopen.o - $(CC) $(CFLAGS) shptreedump.c shptree.o shpopen.o $(LINKOPT) \ - -o shptreedump - - clean: -! rm -f *.o *.a shpcreate shpadd shpdump shprewind dbfcreate dbfadd dbfdump shputils shptest - rm -f shptreedump - rm -rf *.lo *.la .libs - -! test: test1 test2 test3 - - # - # Note this stream only works if example data is accessable. -diff -rc src/shputils.c src_new/shputils.c -*** src/shputils.c 2003-04-07 06:03:22.000000000 -0700 ---- src_new/shputils.c 2011-10-14 14:52:32.179022813 -0700 -*************** -*** 274,280 **** - if (factor == 0) - { - if (infactor ==0) -! { puts("ERROR: Input unit must be defined before output unit"); exit(); } - factor=infactor/outfactor; - } - printf("Output file coordinate values will be factored by %lg\n",factor); ---- 274,280 ---- - if (factor == 0) - { - if (infactor ==0) -! { puts("ERROR: Input unit must be defined before output unit"); exit( 1 ); } - factor=infactor/outfactor; - } - printf("Output file coordinate values will be factored by %lg\n",factor); -diff -rc src/stream1.sh src_new/stream1.sh -*** src/stream1.sh 2003-04-07 06:03:22.000000000 -0700 ---- src_new/stream1.sh 2011-10-19 11:45:08.192964291 -0700 -*************** -*** 1,6 **** - #!/bin/sh - -! EG_DATA=/u/www/projects/shapelib/eg_data - - echo ------------------------------------------------------------------------- - echo Test 1: dump anno.shp ---- 1,6 ---- - #!/bin/sh - -! EG_DATA=./eg_data - - echo ------------------------------------------------------------------------- - echo Test 1: dump anno.shp diff --git a/externalpackages/sqlite/install.sh b/externalpackages/sqlite/install.sh index 2e83a9a4b..ef9bc0540 100755 --- a/externalpackages/sqlite/install.sh +++ b/externalpackages/sqlite/install.sh @@ -4,7 +4,7 @@ set -eu # Constants # -VER="3300100" +VER="3.51.2" PREFIX="${ISSM_DIR}/externalpackages/sqlite/install" # Set to location where external package should be installed @@ -17,21 +17,19 @@ rm -rf ${PREFIX} src mkdir -p ${PREFIX} src # Download source -$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://issm.ess.uci.edu/files/externalpackages/sqlite-autoconf-${VER}.tar.gz" "sqlite-autoconf-${VER}.tar.gz" +$ISSM_DIR/scripts/DownloadExternalPackage.sh "https://github.com/sqlite/sqlite/archive/refs/tags/version-${VER}.tar.gz" "sqlite-version-${VER}.tar.gz" # Unpack source -tar -zxvf sqlite-autoconf-${VER}.tar.gz +tar -zxvf sqlite-version-${VER}.tar.gz # Move source into 'src' directory -mv sqlite-autoconf-${VER}/* src -rm -rf sqlite-autoconf-${VER} +mv sqlite-version-${VER}/* src +rm -rf sqlite-version-${VER} # Configure cd src ./configure \ - --prefix="${PREFIX}" \ - --enable-fast-install \ - --enable-static=no + --prefix="${PREFIX}" # Compile and install if [ $# -eq 0 ]; then diff --git a/externalpackages/valgrind/install-altix64.sh b/externalpackages/valgrind/install-altix64.sh deleted file mode 100755 index 7998c57c6..000000000 --- a/externalpackages/valgrind/install-altix64.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -eu - -#Some cleanup -rm -rf install valgrind-3.10.0 -mkdir install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/valgrind-3.10.0.tar.bz2' 'valgrind-3.10.0.tar.bz2' - -#Untar -tar -jxvf valgrind-3.10.0.tar.bz2 - -#Move valgrind into install directory -mv valgrind-3.10.0/* install -rm -rf valgrind-3.10.0 - -#configure -cd install -./configure --prefix="$ISSM_DIR/externalpackages/valgrind/install" - -#Compile valgrind -make -j 4 -make install - -#final thing: if mpi is compiled in, soft link its target to a simpler name -cd lib -ln -s valgrind/libmpi* ./libmpidebug.so diff --git a/externalpackages/valgrind/install-win32.sh b/externalpackages/valgrind/install-win32.sh deleted file mode 100755 index c9366669a..000000000 --- a/externalpackages/valgrind/install-win32.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -eu - -#Some cleanup -rm -rf install valgrind-3.10.0 -mkdir install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/valgrind-3.10.0.tar.bz2' 'valgrind-3.10.0.tar.bz2' - -#Untar -tar -jxvf valgrind-3.10.0.tar.bz2 - -#Move valgrind into install directory -mv valgrind-3.10.0/* install -rm -rf valgrind-3.10.0 - -#configure -cd install -./configure --prefix="$ISSM_DIR/externalpackages/valgrind/install" - -#Compile valgrind -make -j 4 -make install - -#final thing: if mpi is compiled in, soft link its target to a simpler name -cd lib -ln -s valgrind/libmpi* ./libmpidebug.so diff --git a/externalpackages/vim/install.sh b/externalpackages/vim/install.sh index 11344bb60..37806ad18 100755 --- a/externalpackages/vim/install.sh +++ b/externalpackages/vim/install.sh @@ -1,31 +1,31 @@ #!/bin/bash set -eu -#Some cleanup -rm -rf install src -rm -rf vim72 -mkdir install src -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/vim-7.2.tar.bz2' 'vim-7.2.tar.bz2' +## Constants +# +PREFIX="${ISSM_DIR}/externalpackages/vim/install" # Set to location where external package should be installed -#Untar -bzip2 -d -k vim-7.2.tar.bz2 -tar -xvf vim-7.2.tar -rm vim-7.2.tar +VER="9.1.1943" -#Move vim into install directory -mv vim72/* src -rm -rf vim72 +# Cleanup +rm -rf ${PREFIX} src -#Configure vim (icc seems to have issues with wctype.h) +# Download source +${ISSM_DIR}/scripts/DownloadExternalPackage.sh "https://github.com/vim/vim/archive/refs/tags/v${VER}.tar.gz" "v${VER}.tar.gz" + +# Unpack source +tar -zxvf v${VER}.tar.gz +mv vim-${VER} src + +# Configure (icc seems to have issues with wctype.h) export CC=gcc -cd src/src +cd src/src ./configure \ - --prefix="$ISSM_DIR/externalpackages/vim/install" \ + --prefix="${PREFIX}" \ --with-gcc="/usr/bin/gcc" \ --with-tlib="/lib/" -#Compile vim +# Compile and install make -make install +make install diff --git a/externalpackages/yams/install.sh b/externalpackages/yams/install.sh deleted file mode 100755 index ea53db7f8..000000000 --- a/externalpackages/yams/install.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -#Some cleanup -rm -rf install -mkdir install - -#Download from ISSM server -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/yams2-linux.gz' 'yams2-linux.gz' -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/yams2-osx.gz' 'yams2-osx.gz' -$ISSM_DIR/scripts/DownloadExternalPackage.sh 'https://issm.ess.uci.edu/files/externalpackages/yams2-win.exe' 'yams2-win.exe' - -#loop over the binaries -for i in yams* -do - name=$i; - cp $i install/ - - #uncompress if necessary - if echo $i | grep -q ".gz" - then - gunzip install/$i - fi - - #permissions - chmod 777 install/* -done diff --git a/jenkins/jenkins.sh b/jenkins/jenkins.sh index 83f08803c..2e812fe1c 100755 --- a/jenkins/jenkins.sh +++ b/jenkins/jenkins.sh @@ -449,6 +449,13 @@ source $ISSM_EXT_DIR/shell2junit/install/bin/sh2ju.sh juLogClean if [ $MATLAB_TEST -eq 1 ]; then + # Strip special characters + sed -i \ + -e 's|\[92m||g' \ + -e 's|\[m||g' \ + -e 's|\x1B||g' \ + matlab_log.log + # Number tests numtests=`cat matlab_log.log | grep "\-\-\-\-\-\-\-\-starting" | wc -l` testlist=`cat matlab_log.log | grep "\-\-\-\-\-\-\-\-starting" | sed 's/----------------starting://g' | sed 's/-//g'` @@ -475,6 +482,13 @@ if [ $MATLAB_TEST -eq 1 ]; then fi if [ $PYTHON_TEST -eq 1 ]; then + # Strip special characters + sed -i \ + -e 's|\[92m||g' \ + -e 's|\[m||g' \ + -e 's|\x1B||g' \ + python_log.log + # Number tests numtests=`cat python_log.log | grep "\-\-\-\-\-\-\-\-starting" | wc -l` testlist=`cat python_log.log | grep "\-\-\-\-\-\-\-\-starting" | sed 's/----------------starting://g' | sed 's/-//g'` @@ -501,8 +515,15 @@ if [ $PYTHON_TEST -eq 1 ]; then fi if [ $EXAMPLES_TEST -eq 1 ]; then + # Strip special characters + sed -i \ + -e 's|\[92m||g' \ + -e 's|\[m||g' \ + -e 's|\x1B||g' \ + matlab_log_examples.log + # Inexplicably, there are backspace characters in the error output; remove them - perl -p -i'.bak' -e 's/\x08//g' matlab_log_examples.log + sed -i -e 's|\x08||g' matlab_log_examples.log numtests=`cat matlab_log_examples.log | grep "starting: " | wc -l` testlist=`cat matlab_log_examples.log | grep "starting: " | sed 's/starting: //'` diff --git a/jenkins/mac-silicon-basic b/jenkins/mac-silicon-basic index 4c9b3a8f9..fa98b033d 100755 --- a/jenkins/mac-silicon-basic +++ b/jenkins/mac-silicon-basic @@ -66,7 +66,7 @@ NUMCPUS_RUN=2 # NOTE: # - Tests 124, 703 are excluded because of an outright crash # - Tests 216, 274, 362, 430, 435, 441:442, 456, 470:476, 517 are excluded because of large errors -# - Tests 119, 423, 433, 448, 462:464, 508, 544, 546, 808 are excluded because of failure "Arrays have incompatible sizes for this operation." +# - Tests 119, 423, 433, 448, 462:464, 508, 544, 546, 550, 808 are excluded because of failure "Arrays have incompatible sizes for this operation." # -MATLAB_NROPTIONS="'exclude',[IdFromString('Dakota'),119,124,216,274,362,423,430,433,435,441:442,448,456,462:464,470:476,508,517,544,546,703,808]" +MATLAB_NROPTIONS="'exclude',[IdFromString('Dakota'),119,124,216,274,362,423,430,433,435,441:442,448,456,462:464,470:476,508,517,544,546,550,703,808]" PYTHON_NROPTIONS="" diff --git a/jenkins/matlab-license-check-win.sh b/jenkins/matlab-license-check-win.sh new file mode 100755 index 000000000..c48a947d6 --- /dev/null +++ b/jenkins/matlab-license-check-win.sh @@ -0,0 +1,59 @@ +#!/bin/bash +################################################################################ +# This script tests if MATLAB license will expire soon on Windows. +# +# NOTE: +# - Assumes constant MATLAB_PATH is defined and points to MATLAB executable or +# application. +################################################################################ + +# Convert MATLAB_PATH to Windows format +MATLAB_PATH=$(cygpath -u $(cygpath -ms "${MATLAB_PATH}")) + +# Check if MATLAB exists +if ! [ -d ${MATLAB_PATH} ]; then + echo "${MATLAB_PATH} does not point to a MATLAB installation! Please modify MATLAB_PATH variable in Jenkins job and try again." + exit 1 +fi + +# Start MATLAB, redirecting output to logfile and suppressing output to console +${MATLAB_PATH}/bin/matlab -nodesktop -nosplash -nojvm -r "exit;" -logfile matlab.log & + +# Wait for MATLAB to exit +# +# TODO: +# - Replace by adding -wait option to above calls to matlab? +# +sleep 5; +echo "Waiting for MATLAB to exit" +pid=$(ps -W | grep MATLAB | awk '{print $1}') + +# Time out after $max_time seconds because sometimes multiple MATLAB processes get locked in race condition +timer=0 +max_time=7200 +while [[ $timer -lt $max_time && -n "${pid}" ]]; do + pid=$(ps -W | grep MATLAB | awk '{print $1}') + timer=$((timer + 1)) + sleep 1; +done + +# Check if timer hit $max_time +if [ $timer -eq $max_time ]; then + echo "Testing timed out at ${timer} seconds" + # Kill MATLAB processes + pid=$(ps -W | grep MATLAB | awk '{print $1}') + echo "${pid}" | xargs /bin/kill -f + exit 1 +fi + +# Filter out Windows characters +cat matlab.log | tr -cd '\11\12\40-\176' > matlab.log2 && mv matlab.log2 matlab.log + +# Check log for license expiration message +matlabLicenseExpiring=`grep -c -E "Your license will expire in" matlab.log` + +if [ ${matlabLicenseExpiring} -ne 0 ]; then + cat matlab.log + echo "Login to build node to update MATLAB license." + exit 1; +fi diff --git a/jenkins/matlab-license-check.sh b/jenkins/matlab-license-check.sh new file mode 100755 index 000000000..25672ee56 --- /dev/null +++ b/jenkins/matlab-license-check.sh @@ -0,0 +1,26 @@ +#!/bin/bash +################################################################################ +# This script tests if MATLAB license will expire soon on Linux and macOS. +# +# NOTE: +# - Assumes constant MATLAB_PATH is defined and points to MATLAB executable or +# application. +################################################################################ + +# Check if MATLAB exists +if ! [ -d ${MATLAB_PATH} ]; then + echo "${MATLAB_PATH} does not point to a MATLAB installation! Please modify MATLAB_PATH variable in Jenkins job and try again." + exit 1 +fi + +# Start MATLAB +${MATLAB_PATH}/bin/matlab -nojvm -nosplash -nojvm -r "exit;" &> matlab.log + +# Check log for license expiration message +matlabLicenseExpiring=`grep -c -E "Your license will expire in" matlab.log` + +if [ ${matlabLicenseExpiring} -ne 0 ]; then + cat matlab.log + echo "Login to build node to update MATLAB license." + exit 1; +fi diff --git a/jenkins/ross-debian_linux-codipack b/jenkins/ross-debian_linux-codipack index ab5eefa3d..d17890f35 100755 --- a/jenkins/ross-debian_linux-codipack +++ b/jenkins/ross-debian_linux-codipack @@ -73,4 +73,4 @@ NUMCPUS_RUN=2 # See documentation in test/NightlyRun/runme.* for more information. # MATLAB_NROPTIONS="'benchmark','all','id',[3015,3119,3480,3201:3206]" -PYTHON_NROPTIONS="--benchmark='all' -i 3015 3119 3480" +PYTHON_NROPTIONS="" diff --git a/jenkins/ross-debian_linux-gia b/jenkins/ross-debian_linux-gia deleted file mode 100755 index e1c532798..000000000 --- a/jenkins/ross-debian_linux-gia +++ /dev/null @@ -1,70 +0,0 @@ -MATLAB_PATH="/usr/local/MATLAB/R2023b" - -#--------------------# -# ISSM Configuration # -#--------------------# - -ISSM_CONFIG='\ - --prefix=${ISSM_DIR} \ - --disable-static \ - --enable-development \ - --enable-debugging \ - --with-gia=yes \ - --with-numthreads=4 - --with-matlab-dir=${MATLAB_PATH} \ - --with-python="${HOME}/.venv/issm/bin/python" \ - --with-fortran-lib="-L/usr/lib/x86_64-linux-gnu -lgfortran" \ - --with-mpi-include=${ISSM_DIR}/externalpackages/petsc/install/include \ - --with-mpi-libflags="-L${ISSM_DIR}/externalpackages/petsc/install/lib -lmpi -lmpicxx -lmpifort" \ - --with-blas-lapack-dir=${ISSM_DIR}/externalpackages/petsc/install \ - --with-metis-dir=${ISSM_DIR}/externalpackages/petsc/install \ - --with-parmetis-dir=${ISSM_DIR}/externalpackages/petsc/install \ - --with-scalapack-dir=${ISSM_DIR}/externalpackages/petsc/install \ - --with-mumps-dir=${ISSM_DIR}/externalpackages/petsc/install \ - --with-petsc-dir=${ISSM_DIR}/externalpackages/petsc/install \ - --with-triangle-dir=${ISSM_DIR}/externalpackages/triangle/install \ - --with-math77-dir=${ISSM_DIR}/externalpackages/math77/install \ - --with-semic-dir=${ISSM_DIR}/externalpackages/semic/install \ -' - -#-------------------# -# External Packages # -#-------------------# - -EXTERNALPACKAGES=" - autotools install-linux.sh - cmake install.sh - petsc install-3.23-linux.sh - triangle install-linux.sh - math77 install.sh - gmsh install-4-linux.sh - semic install.sh - shell2junit install.sh -" - -#---------# -# Testing # -#---------# - -# Test suites -MATLAB_TEST=1 -PYTHON_TEST=0 -JAVASCRIPT_TEST=0 -EXAMPLES_TEST=0 - -# Number of CPUs used in ISSM compilation -# -# NOTE: One is usually safer as some packages are very sensitive to parallel -# compilation. -# -NUMCPUS_INSTALL=8 - -# Number of CPUs used in the nightly runs -NUMCPUS_RUN=2 - -# Nightly run options -# -# See documentation in test/NightlyRun/runme.* for more information. -# -MATLAB_NROPTIONS="'benchmark','all','id',[2001:2100]" -PYTHON_NROPTIONS="" diff --git a/m4/issm_options.m4 b/m4/issm_options.m4 index 30268ee03..984c98995 100644 --- a/m4/issm_options.m4 +++ b/m4/issm_options.m4 @@ -1420,45 +1420,6 @@ AC_DEFUN([ISSM_OPTIONS],[ AM_CONDITIONAL([MPI], [test "x${HAVE_MPI}" == "xyes"]) AC_MSG_RESULT([${HAVE_MPI}]) dnl }}} - dnl SCOTCH{{{ - AC_MSG_CHECKING([for SCOTCH]) - AC_ARG_WITH( - [scotch-dir], - AS_HELP_STRING([--with-scotch-dir=DIR], [SCOTCH root directory]), - [SCOTCH_ROOT=$withval], - [SCOTCH_ROOT="no"] - ) - if test "x${SCOTCH_ROOT}" == "xno"; then - HAVE_SCOTCH=no - else - HAVE_SCOTCH=yes - if ! test -d "${SCOTCH_ROOT}"; then - AC_MSG_ERROR([SCOTCH directory provided (${SCOTCH_ROOT}) does not exist!]); - fi - fi - AC_MSG_RESULT([${HAVE_SCOTCH}]) - AM_CONDITIONAL([SCOTCH], [test "x${HAVE_SCOTCH}" == "xyes"]) - - dnl SCOTCH libraries and header files - if test "x${HAVE_SCOTCH}" == "xyes"; then - if test "x${SCOTCH_ROOT}" == "x${PETSC_ROOT}"; then - AC_DEFINE([_PETSC_SCOTCH_], [1], [is SCOTCH installed via PETSc]) - SCOTCHINCL="-DNOFILEIO -I${SCOTCH_ROOT}/include -DSCOTCH_VERSION=\\\"UNKNOWN\\\"" - SCOTCHLIB="-L${SCOTCH_ROOT}/lib -lnfioscotch -lnfioscotcherr -lnfioscotcherrexit " - else - SCOTCHINCL="-I${SCOTCH_ROOT}/include" - SCOTCHLIB="-L${SCOTCH_ROOT}/lib " - if test "x${HAVE_MPI}" == "xyes"; then - SCOTCHLIB+="-lptesmumps -lptscotch -lptscotcherr -lptscotcherrexit -lscotch" - else - SCOTCHLIB+="-lscotch -lscotcherr -lscotcherrexit" - fi - fi - AC_DEFINE([_HAVE_SCOTCH_], [1], [with SCOTCH in ISSM src]) - AC_SUBST([SCOTCHINCL]) - AC_SUBST([SCOTCHLIB]) - fi - dnl }}} dnl METIS{{{ AC_MSG_CHECKING([for METIS]) AC_ARG_WITH( @@ -1673,38 +1634,6 @@ AC_DEFUN([ISSM_OPTIONS],[ AC_SUBST([PROJLIB]) fi dnl }}} - dnl shapelib{{{ - AC_MSG_CHECKING([for shapelib]) - AC_ARG_WITH( - [shapelib-dir], - AS_HELP_STRING([--with-shapelib-dir=DIR], [shapelib root directory]), - [SHAPELIB_ROOT=${withval}], - [SHAPELIB_ROOT="no"] - ) - if test "x${SHAPELIB_ROOT}" == "xno"; then - HAVE_SHAPELIB=no - else - HAVE_SHAPELIB=yes - if ! test -d "${SHAPELIB_ROOT}"; then - AC_MSG_ERROR([shapelib directory provided (${SHAPELIB_ROOT}) does not exist!]); - fi - fi - AC_MSG_RESULT([${HAVE_SHAPELIB}]) - - dnl shapelib libraries and header files - if test "x${HAVE_SHAPELIB}" == "xyes"; then - SHAPELIBINCL="-I${SHAPELIB_ROOT}/include" - if test -f "${SHAPELIB_ROOT}/lib/libshp.a"; then - SHAPELIBLIB="-L${SHAPELIB_ROOT}/lib -lshp" - else - SHAPELIBLIB="-L${SHAPELIB_ROOT}/lib -lshape" - fi - AC_DEFINE([_HAVE_SHAPELIB_], [1], [with shapelib in ISSM src]) - AC_SUBST([SHAPELIBINCL]) - AC_SUBST([SHAPELIBLIB]) - fi - AM_CONDITIONAL([SHP], [test "x${HAVE_SHAPELIB}" == "xyes"]) - dnl }}} dnl ScaLAPACK{{{ dnl NOTE: User should supply path to root directory or libraries, but not both dnl @@ -2287,31 +2216,6 @@ AC_DEFUN([ISSM_OPTIONS],[ fi AC_MSG_RESULT([done]) dnl }}} - dnl MATH77{{{ - AC_MSG_CHECKING([for MATH77]) - AC_ARG_WITH( - [math77-dir], - AS_HELP_STRING([--with-math77-dir=DIR], [MATH77 root directory]), - [MATH77_ROOT=${withval}], - [MATH77_ROOT="no"] - ) - if test "x${MATH77_ROOT}" == "xno"; then - HAVE_MATH77=no - else - HAVE_MATH77=yes - if ! test -d "${MATH77_ROOT}"; then - AC_MSG_ERROR([MATH77 directory provided (${MATH77_ROOT}) does not exist!]); - fi - fi - AC_MSG_RESULT([${HAVE_MATH77}]) - - dnl MATH77 libraries and header files - if test "x${HAVE_MATH77}" == "xyes"; then - MATH77LIB="-L${MATH77_ROOT} -lmath77" - AC_DEFINE([_HAVE_MATH77_], [1], [with MATH77 in ISSM src]) - AC_SUBST([MATH77LIB]) - fi - dnl }}} dnl Fortran{{{ AC_MSG_CHECKING(for Fortran compilation) AC_ARG_WITH( @@ -2487,6 +2391,22 @@ AC_DEFUN([ISSM_OPTIONS],[ AM_CONDITIONAL([KRIGING], [test "x${HAVE_KRIGING}" == "xyes"]) AC_MSG_RESULT([${HAVE_KRIGING}]) dnl }}} + dnl performancemeasurements{{{ + AC_ARG_ENABLE( + [performancemeasurements], + AS_HELP_STRING([--enable-performancemeasurements], [turn performance measurements on]), + [performancemeasurements=${enableval}], + [performancemeasurements=no] + ) + AC_MSG_CHECKING(for performance measurements support) + HAVE_PERF=no + if test "x${performancemeasurements}" == "xyes"; then + HAVE_PERF=yes + AC_DEFINE([_HAVE_PERFORMANCE_MEASUREMENTS_], [1], [Macro to enable performance measurements in ISSM]) + fi + AM_CONDITIONAL([PERFORMANCE_MEASUREMENTS], [test "x${HAVE_PERF}" == "xyes"]) + AC_MSG_RESULT([${HAVE_PERF}]) + dnl }}} dnl Analyses AX_ANALYSES_SELECTION diff --git a/packagers/linux/complete-issm-linux-binaries-matlab.sh b/packagers/linux/complete-issm-linux-binaries-matlab.sh index b16f72002..9dc088b5f 100755 --- a/packagers/linux/complete-issm-linux-binaries-matlab.sh +++ b/packagers/linux/complete-issm-linux-binaries-matlab.sh @@ -33,7 +33,7 @@ ## Constants # -MATLAB_NROPTIONS="'benchmark','all','exclude',[125:126,129,234:235,417:418,420,435,444:445,456,701:703,1101:1110,1201:1208,1301:1304,1401:1402,1601:1602,2002,2004,2006,2010:2013,2020:2021,2052:2053,2090:2092,2110:2113,2424:2425,3001:3300,3480:3481,4001:4100]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded +MATLAB_NROPTIONS="'benchmark','all','exclude',[125:126,129,234:235,417:418,420,435,444:445,456,550,701:703,1101:1110,1201:1208,1301:1304,1401:1402,1601:1602,2002,2004,2006,2010:2013,2020:2021,2052:2053,2090:2092,2110:2113,2424:2425,3001:3300,3480:3481,4001:4100]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded MATLAB_PATH="/usr/local/MATLAB/R2023b" PKG="ISSM-Linux-MATLAB" # Name of directory to copy distributable files to diff --git a/packagers/linux/complete-issm-linux-binaries-python-3.sh b/packagers/linux/complete-issm-linux-binaries-python-3.sh index 7daefe9d0..34e46d56c 100755 --- a/packagers/linux/complete-issm-linux-binaries-python-3.sh +++ b/packagers/linux/complete-issm-linux-binaries-python-3.sh @@ -34,7 +34,7 @@ ## Constants # PKG="ISSM-Linux-Python-3" # Name of directory to copy distributable files to -PYTHON_NROPTIONS="--benchmark all --exclude 125:126 129 234:235 417:418 420 435 444:445 456 701:703 1101:1110 1201:1208 1301:1304 1401:1402 1601:1602 2002 2004 2006 2010:2013 2020:2021 2052:2053 2090:2092 2110:2113 2424:2425 3001:3300 3480:3481 4001:4100" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded +PYTHON_NROPTIONS="--benchmark all --exclude 125:126 129 234:235 417:418 420 435 444:445 456 550 701:703 1101:1110 1201:1208 1301:1304 1401:1402 1601:1602 2002 2004 2006 2010:2013 2020:2021 2052:2053 2090:2092 2110:2113 2424:2425 3001:3300 3480:3481 4001:4100" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded COMPRESSED_PKG="${PKG}.tar.gz" diff --git a/packagers/linux/package-issm-linux-binaries-matlab.sh b/packagers/linux/package-issm-linux-binaries-matlab.sh index f6928891f..13402a1b0 100755 --- a/packagers/linux/package-issm-linux-binaries-matlab.sh +++ b/packagers/linux/package-issm-linux-binaries-matlab.sh @@ -34,9 +34,9 @@ LIBGCC="/usr/lib/x86_64-linux-gnu/libgcc_s.so.1" # Important that this is the li LIBGCC_DIST="${ISSM_DIR}/lib/libgcc_s.so.1" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it LIBGFORTRAN="/usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0" # Important that this is the library itself LIBGFORTRAN_DIST="${ISSM_DIR}/lib/libgfortran.so.5" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it -LIBGMT="${ISSM_DIR}/externalpackages/gmt/install/lib/libgmt.so.6.5.0" # Important that this is the library itself +LIBGMT="${ISSM_DIR}/externalpackages/gmt/install/lib/libgmt.so.6.6.0" # Important that this is the library itself LIBGMT_DIST="${ISSM_DIR}/lib/libgmt.so.6" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it -LIBPSL="${ISSM_DIR}/externalpackages/gmt/install/lib/libpostscriptlight.so.6.5.0" # Important that this is the library itself +LIBPSL="${ISSM_DIR}/externalpackages/gmt/install/lib/libpostscriptlight.so.6.6.0" # Important that this is the library itself LIBPSL_DIST="${ISSM_DIR}/lib/libpostscriptlight.so.6" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it LIBQUADMATH="/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0" # Important that this is the library itself LIBQUADMATH_DIST="${ISSM_DIR}/lib/libquadmath.so.0" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it diff --git a/packagers/linux/package-issm-linux-binaries-python-3.sh b/packagers/linux/package-issm-linux-binaries-python-3.sh index eb5aa7e30..048c4fae3 100755 --- a/packagers/linux/package-issm-linux-binaries-python-3.sh +++ b/packagers/linux/package-issm-linux-binaries-python-3.sh @@ -34,9 +34,9 @@ LIBGCC="/usr/lib/x86_64-linux-gnu/libgcc_s.so.1" # Important that this is the li LIBGCC_DIST="${ISSM_DIR}/lib/libgcc_s.so.1" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it LIBGFORTRAN="/usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0" # Important that this is the library itself LIBGFORTRAN_DIST="${ISSM_DIR}/lib/libgfortran.so.5" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it -LIBGMT="${ISSM_DIR}/externalpackages/gmt/install/lib/libgmt.so.6.5.0" # Important that this is the library itself +LIBGMT="${ISSM_DIR}/externalpackages/gmt/install/lib/libgmt.so.6.6.0" # Important that this is the library itself LIBGMT_DIST="${ISSM_DIR}/lib/libgmt.so.6" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it -LIBPSL="${ISSM_DIR}/externalpackages/gmt/install/lib/libpostscriptlight.so.6.5.0" # Important that this is the library itself +LIBPSL="${ISSM_DIR}/externalpackages/gmt/install/lib/libpostscriptlight.so.6.6.0" # Important that this is the library itself LIBPSL_DIST="${ISSM_DIR}/lib/libpostscriptlight.so.6" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it LIBQUADMATH="/usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0" # Important that this is the library itself LIBQUADMATH_DIST="${ISSM_DIR}/lib/libquadmath.so.0" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it diff --git a/packagers/mac/complete-issm-mac-intel-binaries-matlab.sh b/packagers/mac/complete-issm-mac-intel-binaries-matlab.sh index 01aa58bd0..ebdf59bea 100755 --- a/packagers/mac/complete-issm-mac-intel-binaries-matlab.sh +++ b/packagers/mac/complete-issm-mac-intel-binaries-matlab.sh @@ -63,16 +63,19 @@ ## Constants # +PKG="ISSM-macOS-Intel-MATLAB" # Name of directory to copy distributable files to +VARIANT_REPO_SUBPATH="intel/matlab" + MATLAB_NROPTIONS="'benchmark','all','exclude',[124:126,129,234:235,417:418,420,435,444:445,456,701:703,1101:1110,1201:1208,1301:1304,1401:1402,1601:1602,2002,2004,2006,2010:2013,2020:2021,2052:2053,2085,2090:2092,2110:2113,2424:2425,3001:3300,3480:3481,4001:4100]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded MATLAB_PATH="/Applications/MATLAB_R2023b.app" -PKG="ISSM-macOS-Intel-MATLAB" # Name of directory to copy distributable files to -REPO_BASE_URL="https://issm.ess.uci.edu/svn/issm-binaries/mac/intel/matlab" +SIGNING_REPO_BASE_URL="https://issm.ess.uci.edu/svn/issm-macos-signing" +SIGNING_REPO_URL="${SIGNING_REPO_BASE_URL}/${VARIANT_REPO_SUBPATH}" SIGNED_REPO_COPY="./signed" -SIGNED_REPO_URL="${REPO_BASE_URL}/signed" UNSIGNED_REPO_COPY="./unsigned" -UNSIGNED_REPO_URL="${REPO_BASE_URL}/unsigned" COMPRESSED_PKG="${PKG}.zip" +SIGNED_REPO_URL="${SIGNING_REPO_URL}/signed" +UNSIGNED_REPO_URL="${SIGNING_REPO_URL}/unsigned" ## Environment # diff --git a/packagers/mac/complete-issm-mac-intel-binaries-python-3.sh b/packagers/mac/complete-issm-mac-intel-binaries-python-3.sh index 395dddb4e..b32138011 100755 --- a/packagers/mac/complete-issm-mac-intel-binaries-python-3.sh +++ b/packagers/mac/complete-issm-mac-intel-binaries-python-3.sh @@ -64,14 +64,17 @@ ## Constants # PKG="ISSM-macOS-Intel-Python-3" # Name of directory to copy distributable files to +VARIANT_REPO_SUBPATH="intel/python" + PYTHON_NROPTIONS="--benchmark all --exclude 124:126 129 234:235 417:418 420 435 444:445 456 701:703 1101:1110 1201:1208 1301:1304 1401:1402 1601:1602 2002 2004 2006 2010:2013 2020:2021 2052:2053 2085 2090:2092 2110:2113 2424:2425 3001:3300 3480:3481 4001:4100" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded -REPO_BASE_URL="https://issm.ess.uci.edu/svn/issm-binaries/mac/intel/python/3" +SIGNING_REPO_BASE_URL="https://issm.ess.uci.edu/svn/issm-macos-signing" +SIGNING_REPO_URL="${SIGNING_REPO_BASE_URL}/${VARIANT_REPO_SUBPATH}" SIGNED_REPO_COPY="./signed" -SIGNED_REPO_URL="${REPO_BASE_URL}/signed" UNSIGNED_REPO_COPY="./unsigned" -UNSIGNED_REPO_URL="${REPO_BASE_URL}/unsigned" COMPRESSED_PKG="${PKG}.zip" +SIGNED_REPO_URL="${SIGNING_REPO_URL}/signed" +UNSIGNED_REPO_URL="${SIGNING_REPO_URL}/unsigned" ## Environment # diff --git a/packagers/mac/complete-issm-mac-silicon-binaries-matlab.sh b/packagers/mac/complete-issm-mac-silicon-binaries-matlab.sh index 115241c44..3356f8e7b 100755 --- a/packagers/mac/complete-issm-mac-silicon-binaries-matlab.sh +++ b/packagers/mac/complete-issm-mac-silicon-binaries-matlab.sh @@ -63,16 +63,19 @@ ## Constants # +PKG="ISSM-macOS-Silicon-MATLAB" # Name of directory to copy distributable files to +VARIANT_REPO_SUBPATH="silicon/matlab" + MATLAB_NROPTIONS="'benchmark','all','exclude',[119,124:126,129,216,234:235,274,362,417:418,420,423,430,433,435,441:442,444:445,448,456,462:464,470:476,508,517,544,546,701:703,808,1101:1110,1201:1208,1301:1304,1401:1402,1601:1602,2002,2004,2006,2010:2013,2020:2021,2052:2053,2085,2090:2092,2110:2113,2424:2425,3001:3300,3480:3481,4001:4100]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded MATLAB_PATH="/Applications/MATLAB_R2023b.app" -PKG="ISSM-macOS-Silicon-MATLAB" # Name of directory to copy distributable files to -REPO_BASE_URL="https://issm.ess.uci.edu/svn/issm-binaries/mac/silicon/matlab" +SIGNING_REPO_BASE_URL="https://issm.ess.uci.edu/svn/issm-macos-signing" +SIGNING_REPO_URL="${SIGNING_REPO_BASE_URL}/${VARIANT_REPO_SUBPATH}" SIGNED_REPO_COPY="./signed" -SIGNED_REPO_URL="${REPO_BASE_URL}/signed" UNSIGNED_REPO_COPY="./unsigned" -UNSIGNED_REPO_URL="${REPO_BASE_URL}/unsigned" COMPRESSED_PKG="${PKG}.zip" +SIGNED_REPO_URL="${SIGNING_REPO_URL}/signed" +UNSIGNED_REPO_URL="${SIGNING_REPO_URL}/unsigned" ## Environment # diff --git a/packagers/mac/complete-issm-mac-silicon-binaries-python-3.sh b/packagers/mac/complete-issm-mac-silicon-binaries-python-3.sh index e0b2f1dd7..908bef026 100755 --- a/packagers/mac/complete-issm-mac-silicon-binaries-python-3.sh +++ b/packagers/mac/complete-issm-mac-silicon-binaries-python-3.sh @@ -64,14 +64,17 @@ ## Constants # PKG="ISSM-macOS-Silicon-Python-3" # Name of directory to copy distributable files to +VARIANT_REPO_SUBPATH="silicon/python" + PYTHON_NROPTIONS="--benchmark all --exclude 119 124:126 129 216 234:235 274 362 417:418 420 423 430 433 435 441:442 444:445 448 456 462:464 470:476 508 517 544 546 701:703 808 1101:1110 1201:1208 1301:1304 1401:1402 1601:1602 2002 2004 2006 2010:2013 2020:2021 2052:2053 2085 2090:2092 2110:2113 2424:2425 3001:3300 3480:3481 4001:4100" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded -REPO_BASE_URL="https://issm.ess.uci.edu/svn/issm-binaries/mac/silicon/python/3" +SIGNING_REPO_BASE_URL="https://issm.ess.uci.edu/svn/issm-macos-signing" +SIGNING_REPO_URL="${SIGNING_REPO_BASE_URL}/${VARIANT_REPO_SUBPATH}" SIGNED_REPO_COPY="./signed" -SIGNED_REPO_URL="${REPO_BASE_URL}/signed" UNSIGNED_REPO_COPY="./unsigned" -UNSIGNED_REPO_URL="${REPO_BASE_URL}/unsigned" COMPRESSED_PKG="${PKG}.zip" +SIGNED_REPO_URL="${SIGNING_REPO_URL}/signed" +UNSIGNED_REPO_URL="${SIGNING_REPO_URL}/unsigned" ## Environment # diff --git a/packagers/mac/package-issm-mac-binaries-matlab.sh b/packagers/mac/package-issm-mac-binaries-matlab.sh index 039e32c3e..40c6c6805 100755 --- a/packagers/mac/package-issm-mac-binaries-matlab.sh +++ b/packagers/mac/package-issm-mac-binaries-matlab.sh @@ -33,9 +33,9 @@ alias grep=$(which grep) ## Constants # -LIBGMT="${ISSM_DIR}/externalpackages/gmt/install/lib/libgmt.6.5.0.dylib" # Important that this is the library itself +LIBGMT="${ISSM_DIR}/externalpackages/gmt/install/lib/libgmt.6.6.0.dylib" # Important that this is the library itself LIBGMT_DIST="${ISSM_DIR}/lib/libgmt.6.dylib" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it -LIBPSL="${ISSM_DIR}/externalpackages/gmt/install/lib/libpostscriptlight.6.5.0.dylib" # Important that this is the library itself +LIBPSL="${ISSM_DIR}/externalpackages/gmt/install/lib/libpostscriptlight.6.6.0.dylib" # Important that this is the library itself LIBPSL_DIST="${ISSM_DIR}/lib/libpostscriptlight.6.dylib" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it ## Environment @@ -148,7 +148,7 @@ if [ ${skip_tests} -eq 0 ]; then ${MATLAB_PATH}/bin/matlab -nojvm -nosplash -nojvm -r "try, addpath ${ISSM_DIR}/bin ${ISSM_DIR}/lib ${ISSM_DIR}/share; runme(${MATLAB_NROPTIONS}); exit; catch me,fprintf('%s',getReport(me)); exit; end" &> matlab.log # Check that MATLAB did not exit in error - matlabExitedInError=`grep -c -E "Activation cannot proceed|Error in|Illegal|Invalid MEX-file|license|Warning: Name is nonexistent or not a directory" matlab.log` + matlabExitedInError=`grep -c -E "Activation cannot proceed|Error in|Illegal|Invalid MEX-file|Warning: Name is nonexistent or not a directory" matlab.log` if [ ${matlabExitedInError} -ne 0 ]; then echo "----------MATLAB exited in error!----------" diff --git a/packagers/mac/package-issm-mac-binaries-python-3.sh b/packagers/mac/package-issm-mac-binaries-python-3.sh index c7b8d51eb..9c6e33214 100755 --- a/packagers/mac/package-issm-mac-binaries-python-3.sh +++ b/packagers/mac/package-issm-mac-binaries-python-3.sh @@ -32,9 +32,9 @@ alias grep=$(which grep) ## Constants # -LIBGMT="${ISSM_DIR}/externalpackages/gmt/install/lib/libgmt.6.5.0.dylib" # Important that this is the library itself +LIBGMT="${ISSM_DIR}/externalpackages/gmt/install/lib/libgmt.6.6.0.dylib" # Important that this is the library itself LIBGMT_DIST="${ISSM_DIR}/lib/libgmt.6.dylib" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it -LIBPSL="${ISSM_DIR}/externalpackages/gmt/install/lib/libpostscriptlight.6.5.0.dylib" # Important that this is the library itself +LIBPSL="${ISSM_DIR}/externalpackages/gmt/install/lib/libpostscriptlight.6.6.0.dylib" # Important that this is the library itself LIBPSL_DIST="${ISSM_DIR}/lib/libpostscriptlight.6.dylib" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it ## Environment diff --git a/packagers/mac/sign-issm-mac-binaries.sh b/packagers/mac/sign-issm-mac-binaries.sh index 50705ad6c..e7d3875d1 100755 --- a/packagers/mac/sign-issm-mac-binaries.sh +++ b/packagers/mac/sign-issm-mac-binaries.sh @@ -4,7 +4,7 @@ # Intended to be run in the context of a Jenkins project on a JPL # Cybersecurity server for signing macOS applications. Polls SCM of the # Subversion repository hosted at -# https://issm.ess.uci.edu/svn/issm-binaries/mac//[/]/unsigned to +# https://issm.ess.uci.edu/svn/issm-macos-signing///unsigned to # trigger new builds. # # In order to replicate the required Jenkins project configuration, @@ -19,12 +19,12 @@ # - under 'Source Code Management', select 'Subversion', # - the 'Repository URL' text field should be set to # -# https://issm.ess.uci.edu/svn/issm-binaries/mac//[/]/unsigned +# https://issm.ess.uci.edu/svn/issm-binaries/mac///unsigned # # where, # # 'intel' or 'silicon' -# [/] 'matlab' or 'python/3' +# 'matlab' or 'python' # # - the 'Credentials' select menu should be set to the new credentials # created previously. @@ -75,26 +75,27 @@ ASC_PROVIDER="**********" ## NOTE: The following need to be set for the particular signing job (see comments for options) # -PKG="ISSM-macOS--[-]" # : 'Intel' or 'Silicon'; [-]: 'MATLAB' or 'Python-3' -VARIANT_REPO_SUBPATH="/[/]" # : 'intel' or 'silicon'; [-]: 'matlab' or 'python/3' +PKG="ISSM-macOS--" # : 'Intel' or 'Silicon'; : 'MATLAB' or 'Python-3' +VARIANT_REPO_SUBPATH="/" # : 'intel' or 'silicon'; : 'matlab' or 'python' +EXE_ENTITLEMENTS_PLIST="${PKG}/bin/entitlements.plist" MAX_SVN_ATTEMPTS=10 NOTARIZATION_CHECK_ATTEMPTS=20 NOTARIZATION_CHECK_PERIOD=60 NOTARIZATION_LOGFILE="notarization.log" NOTARIZATION_LOGFILE_PATH="." PASSWORD=${ISSM_BINARIES_PASS} -REPO_URL="https://issm.ess.uci.edu/svn/issm-binaries" +SIGNING_REPO_BASE_URL="https://issm.ess.uci.edu/svn/issm-macos-signing" +SIGNING_REPO_URL="${SIGNING_REPO_BASE_URL}/${VARIANT_REPO_SUBPATH}" SIGNED_REPO_COPY="./signed" -SIGNED_REPO_URL="${REPO_URL}/${VARIANT_REPO_SUBPATH}/signed" SIGNING_LOCK_FILE="signing.lock" -SUCCESS_LOGFILE="${SIGNED_REPO_COPY}/success.log" UNSIGNED_REPO_COPY="./unsigned" -UNSIGNED_REPO_URL="${REPO_URL}/${VARIANT_REPO_SUBPATH}/unsigned" -USERNAME=${ISSM_BINARIES_USER} +USERNAME=${ISSM_USERNAME} COMPRESSED_PKG="${PKG}.zip" -EXE_ENTITLEMENTS_PLIST="${PKG}/bin/entitlements.plist" + +SIGNED_REPO_URL="${SIGNING_REPO_URL}/signed" +UNSIGNED_REPO_URL="${SIGNING_REPO_URL}/unsigned" # NOTE: Uncomment the following for local testing (Jenkins checks out copy of # repository for unsigned packages to working directory) @@ -124,29 +125,45 @@ ditto -xk ${UNSIGNED_REPO_COPY}/${COMPRESSED_PKG} . # Clear extended attributes on all files xattr -cr ${PKG} -# Build list of ISSM executables +# Build list of ISSM executables, libraries, and packages ISSM_BINS=$(\ + find ${PKG}/lib -type f -name *.dylib; \ find ${PKG}/bin -type f -name *.exe; \ - find ${PKG}/bin -type f -name *.pyc; \ find ${PKG}/lib -type f -name *.mexmaca64; \ find ${PKG}/lib -type f -name *.mexmaci64; \ find ${PKG}/test -type f -name *.pkg; \ + find ${PKG}/bin -type f -name *.pyc; \ + find ${PKG}/lib -type f -name *.so; \ ) # Build list of third party executables THIRD_PARTY_BINS=$(\ - echo ${PKG}/bin/mpiexec; \ - echo ${PKG}/bin/hydra_pmi_proxy; \ echo ${PKG}/bin/gdalsrsinfo; \ echo ${PKG}/bin/gdaltransform; \ echo ${PKG}/bin/gmsh; \ echo ${PKG}/bin/gmt; \ + echo ${PKG}/bin/hydra_pmi_proxy; \ + echo ${PKG}/bin/mpiexec; \ + echo ${PKG}/bin/projinfo; \ ) # Sign all executables in package -echo "Signing all executables in package" -codesign -s ${AD_IDENTITY} --timestamp --options=runtime --entitlements ${EXE_ENTITLEMENTS_PLIST} ${ISSM_BINS} -codesign -s ${AD_IDENTITY} --timestamp --options=runtime ${THIRD_PARTY_BINS} +echo "Signing ISSM executables, libraries, and packges in package" +codesign -s ${AD_IDENTITY} -v --timestamp --options=runtime --entitlements ${EXE_ENTITLEMENTS_PLIST} ${ISSM_BINS} +for ISSM_BIN in "${ISSM_BINS[@]}"; do + codesign -s ${AD_IDENTITY} -v --timestamp --options=runtime ${ISSM_BIN} +done + +echo "Signing third-party executables in package" +for THIRD_PARTY_BIN in "${THIRD_PARTY_BINS[@]}"; do + codesign -s ${AD_IDENTITY} -v --timestamp --options=runtime ${THIRD_PARTY_BIN} +done + +# Validate timestamp +echo "Validating timestamp on an ISSM executable" +codesign -dvv ${PKG}/bin/issm.exe +echo "Validating timestamp on a third-party executable" +codesign -dvv ${PKG}/bin/hydra_pmi_proxy # NOTE: Skipping signature validation because this is not a true package nor app diff --git a/packagers/mac/test-issm-mac-binaries-matlab.sh b/packagers/mac/test-issm-mac-binaries-matlab.sh index 1c87f2e2a..ad08a0c6a 100755 --- a/packagers/mac/test-issm-mac-binaries-matlab.sh +++ b/packagers/mac/test-issm-mac-binaries-matlab.sh @@ -10,7 +10,7 @@ ## Constants # INSTALL_DIR=${PWD} -MATLAB_NROPTIONS="'benchmark','all','exclude',[125,126,129,234,235,418,420,435,444,445,701,702,703,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1201,1202,1203,1204,1205,1206,1207,1208,1301,1302,1303,1304,1401,1402,1601,1602,2002,2003,2004,2006,2007,2008,2010,2011,2012,2013,2020,2021,2051,2052,2053,2084,2085,2090,2091,2092,2101,2424,2425,3001:3300,3480,3481,4001:4100]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded +MATLAB_NROPTIONS="'benchmark','all','exclude',[125,126,129,234,235,418,420,435,444,445,550,701,702,703,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1201,1202,1203,1204,1205,1206,1207,1208,1301,1302,1303,1304,1401,1402,1601,1602,2002,2003,2004,2006,2007,2008,2010,2011,2012,2013,2020,2021,2051,2052,2053,2084,2085,2090,2091,2092,2101,2424,2425,3001:3300,3480,3481,4001:4100]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded MATLAB_PATH="/Applications/MATLAB_R2022b.app" PKG="ISSM-macOS-MATLAB" diff --git a/packagers/mac/test-issm-mac-binaries-python-3.sh b/packagers/mac/test-issm-mac-binaries-python-3.sh index cbd1d604d..5812d5077 100755 --- a/packagers/mac/test-issm-mac-binaries-python-3.sh +++ b/packagers/mac/test-issm-mac-binaries-python-3.sh @@ -11,7 +11,7 @@ # INSTALL_DIR=${PWD} PKG="ISSM-macOS-Python-3" -PYTHON_NROPTIONS="--benchmark all --exclude 125 126 129 234 235 418 420 435 444 445 701 702 703 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1201 1202 1203 1204 1205 1206 1207 1208 1301 1302 1303 1304 1401 1402 1601 1602 2002 2003 2004 2005 2006 2007 2008 2010 2011 2012 2013 2020 2021 2051 2052 2053 2084 2085 2090 2091 2092 2101 2424 2425 3001:3300 3480 3481 4001:4100" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded +PYTHON_NROPTIONS="--benchmark all --exclude 125 126 129 234 235 418 420 435 444 445 550 701 702 703 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1201 1202 1203 1204 1205 1206 1207 1208 1301 1302 1303 1304 1401 1402 1601 1602 2002 2003 2004 2005 2006 2007 2008 2010 2011 2012 2013 2020 2021 2051 2052 2053 2084 2085 2090 2091 2092 2101 2424 2425 3001:3300 3480 3481 4001:4100" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded COMPRESSED_PKG="${PKG}.zip" diff --git a/packagers/win/package-issm-win-binaries-matlab.sh b/packagers/win/package-issm-win-binaries-matlab.sh index 668c4c1c8..6e9738f4d 100644 --- a/packagers/win/package-issm-win-binaries-matlab.sh +++ b/packagers/win/package-issm-win-binaries-matlab.sh @@ -29,7 +29,7 @@ alias grep=$(which grep) # #LIBGFORTRAN="/usr/lib/x86_64-win-gnu/libgfortran.so.5.0.0" # Important that this is the library itself #LIBGFORTRAN_DIST="${ISSM_DIR}/lib/libgfortran.so.5" # Important the file name matches the SONAME entry in the binaries and other shared libraries which link to it -MATLAB_NROPTIONS="'exclude',[IdFromString('Dakota'),125,126,129,435,701,702,703]" +MATLAB_NROPTIONS="'exclude',[IdFromString('Dakota'),125,126,129,435,550,701,702,703]" #MATLAB_NROPTIONS="'benchmark','all','exclude',[125,126,129,234,235,418,420,435,444,445,701,702,703,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1201,1202,1203,1204,1205,1206,1207,1208,1301,1302,1303,1304,1401,1402,1601,1602,2002,2003,2004,2006,2007,2008,2010,2011,2012,2013,2020,2021,2051,2052,2053,2084,2085,2090,2091,2092,2101,2424,2425,3001:3300,3480,3481,4001:4100]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded MATLAB_PATH=$(cygpath -u $(cygpath -ms "/c/Program Files/MATLAB/R2023b")) MSMPI_ROOT="${ISSM_DIR}/externalpackages/msmpi/install" diff --git a/scripts/api_coverage.sh b/scripts/api_coverage.sh new file mode 100755 index 000000000..00319ead7 --- /dev/null +++ b/scripts/api_coverage.sh @@ -0,0 +1,54 @@ +#!/bin/bash +################################################################################ +# This script determines coverage of Python API compared to MATLAB API, +# assuming that number of MATLAB scripts will always be >= number of Python +# scripts. +# +# TODO: +# - Add coverage reports for JavaScript, Julia. +# - Generalize by allowing two or more file extension arguments to count and +# compare? +################################################################################ + +## Functions +# +function recursive_process() { + local dir="${1}" + for file in "${dir}"/*; do + if [[ -f "${file}" && "${file}" == */test*.m ]]; then + ((++num_m)) + basename=$(basename "${file}" ".m") + if [[ -f "${dir}/${basename}.py" ]]; then + ((++num_py)) + else + missing+=("${file}") + fi + elif [ -d "${file}" ]; then + recursive_process "${file}" + fi + done +} + +## Variables +# +missing=() +num_m=0 +num_py=0 + +# Process arguments +if [ "$#" -gt 0 ]; then + TARGET=$1 +else + echo "Error: please supply the path to the directory whose contents you want to analyze." + exit 1 +fi + +## Main +# +recursive_process "${TARGET}" + +# Print report +coverage=$(printf '%.2f' $(echo "scale=4; $num_py / $num_m * 100" | bc)) +echo "In directory ${TARGET} there are ${num_m} MATLAB scripts and ${num_py} Python scripts for a Python API coverage of ${coverage}%" +#echo "The following MATLAB scripts are missing a Python translation..." +#printf "%s\n" "${missing[@]}" diff --git a/src/c/Makefile.am b/src/c/Makefile.am index 82450647c..48afc8a09 100644 --- a/src/c/Makefile.am +++ b/src/c/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @SHAPELIBINCL@ @TRIANGLEINCL@ @PETSCINCL@ @AMPIINCL@ @MEDIPACKINCL@ @MPIINCL@ @PARMETISINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADOLCINCL@ @CODIPACKINCL@ @ADJOINTPETSCINCL@ @GSLINCL@ @BOOSTINCL@ @ESMFINCL@ @PROJINCL@ @MPLAPACKINCL@ +AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @TRIANGLEINCL@ @PETSCINCL@ @AMPIINCL@ @MEDIPACKINCL@ @MPIINCL@ @PARMETISINCL@ @METISINCL@ @CHACOINCL@ @PLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @SPAIINCL@ @HYPREINCL@ @PROMETHEUSINCL@ @SUPERLUINCL@ @SPOOLESINCL@ @PASTIXINCL@ @MLINCL@ @TAOINCL@ @ADOLCINCL@ @CODIPACKINCL@ @ADJOINTPETSCINCL@ @GSLINCL@ @BOOSTINCL@ @ESMFINCL@ @PROJINCL@ @MPLAPACKINCL@ AM_FCFLAGS = @SEMICINCL@ AUTOMAKE_OPTIONS = subdir-objects @@ -672,9 +672,6 @@ modules_sources += \ ./modules/Chacox/chaco_seconds.cpp \ ./modules/Chacox/user_params.cpp endif -if SCOTCH -modules_sources += ./modules/Scotchx/Scotchx.cpp -endif #}}} # Kriging (wrapper and executable) @@ -707,7 +704,7 @@ endif libISSMCore_la_SOURCES = $(issm_sources) libISSMCore_la_CXXFLAGS = $(ALL_CXXFLAGS) libISSMCore_la_FFLAGS = $(AM_FFLAGS) -libISSMCore_LIB_ADD = $(CHACOLIB) $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(PROJLIB) $(ADJOINTPETSCLIB) +libISSMCore_LIB_ADD = $(CHACOLIB) $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(PROJLIB) $(ADJOINTPETSCLIB) if FORTRAN libISSMCore_LIB_ADD += $(FLIBS) $(FORTRANLIB) endif @@ -853,7 +850,7 @@ LDADD += ./libISSMModules.la $(TRIANGLELIB) endif # External packages -LDADD += $(DAKOTALIB) $(SEMICLIB) $(M1QN3LIB) $(CHACOLIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(NEOPZLIB) $(TAOLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HDF5LIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(AMPILIB) $(ADOLCLIB) $(MPILIB) $(ESMFLIB) +LDADD += $(DAKOTALIB) $(SEMICLIB) $(M1QN3LIB) $(CHACOLIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(NEOPZLIB) $(TAOLIB) $(PLAPACKLIB) $(MPLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(BLACSLIB) $(HDF5LIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(MKLLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(AMPILIB) $(ADOLCLIB) $(MPILIB) $(ESMFLIB) if FORTRAN LDADD += $(FLIBS) $(FORTRANLIB) diff --git a/src/c/analyses/HydrologyGlaDSAnalysis.cpp b/src/c/analyses/HydrologyGlaDSAnalysis.cpp index c2a0a48c8..eb6d97a9a 100644 --- a/src/c/analyses/HydrologyGlaDSAnalysis.cpp +++ b/src/c/analyses/HydrologyGlaDSAnalysis.cpp @@ -150,17 +150,12 @@ void HydrologyGlaDSAnalysis::UpdateElements(Elements* elements,Inputs* inputs,Io iomodel->FetchDataToInput(inputs,elements,"md.initialization.watercolumn",HydrologySheetThicknessEnum); iomodel->FetchDataToInput(inputs,elements,"md.initialization.hydraulic_potential",HydraulicPotentialEnum); iomodel->FetchDataToInput(inputs,elements,"md.hydrology.rheology_B_base",HydrologyRheologyBBaseEnum); - + iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum); + iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyEnum); if(iomodel->domaintype==Domain2DhorizontalEnum){ - iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum); - iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyEnum); iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxBaseEnum); iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyBaseEnum); } - else{ - iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum); - iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyEnum); - } /*Friction*/ FrictionUpdateInputs(elements, inputs, iomodel); diff --git a/src/c/analyses/HydrologyShaktiAnalysis.cpp b/src/c/analyses/HydrologyShaktiAnalysis.cpp index 522445281..de9674395 100644 --- a/src/c/analyses/HydrologyShaktiAnalysis.cpp +++ b/src/c/analyses/HydrologyShaktiAnalysis.cpp @@ -134,6 +134,13 @@ void HydrologyShaktiAnalysis::UpdateElements(Elements* elements,Inputs* inputs,I iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyBaseEnum); } + /*Initialize requested outputs in case they are not defined later for this partition*/ + iomodel->ConstantToInput(inputs,elements,0.,HydrologyBasalFluxEnum,P0Enum); + iomodel->ConstantToInput(inputs,elements,0.,DegreeOfChannelizationEnum,P0Enum); + iomodel->ConstantToInput(inputs,elements,0.,HydrologyMeltRateEnum,P0Enum); + iomodel->ConstantToInput(inputs,elements,0.,HydrologyFrictionHeatEnum,P0Enum); + iomodel->ConstantToInput(inputs,elements,0.,HydrologyDissipationEnum,P0Enum); + /*Friction*/ FrictionUpdateInputs(elements, inputs, iomodel); }/*}}}*/ @@ -493,9 +500,8 @@ void HydrologyShaktiAnalysis::UpdateConstraints(FemModel* femmodel){/* node->Activate(); //Not sure if we need this! } else{ - IssmDouble phi = rho_ice*g*thickness[in] + rho_water*g*bed[in]; //FIXME this is correct! - node->Deactivate();// Not sure if we need this - node->ApplyConstraint(0,phi); + node->Deactivate();// node should be inactive + node->ApplyConstraint(0,0.0); // set head (dof 0) to 0.0 m } } xDelete(mask); @@ -709,6 +715,14 @@ void HydrologyShaktiAnalysis::UpdateEffectivePressure(Element* element){/*{{{*/ N[i] = rho_ice*g*thickness - rho_water*g*(head-bed); } + /*Set to 0 if inactive element*/ + if(element->IsAllFloating() || !element->IsIceInElement()){ + for(int iv=0;ivAddInput(EffectivePressureEnum,N,P1Enum); + xDelete(N); + return; + } + /*Add new gap as an input*/ element->AddBasalInput(EffectivePressureEnum,N,element->GetElementType()); diff --git a/src/c/analyses/LevelsetAnalysis.cpp b/src/c/analyses/LevelsetAnalysis.cpp index b23a3c803..d13ae5b2d 100644 --- a/src/c/analyses/LevelsetAnalysis.cpp +++ b/src/c/analyses/LevelsetAnalysis.cpp @@ -348,7 +348,6 @@ void LevelsetAnalysis::Core(FemModel* femmodel){/*{{{*/ /*activate formulation: */ femmodel->SetCurrentConfiguration(LevelsetAnalysisEnum); - if(VerboseSolution()) _printf0_(" call computational core:\n"); if(stabilization==4){ solutionsequence_fct(femmodel); } diff --git a/src/c/classes/Elements/PentaRef.cpp b/src/c/classes/Elements/PentaRef.cpp index 88ac40589..9720c0cde 100644 --- a/src/c/classes/Elements/PentaRef.cpp +++ b/src/c/classes/Elements/PentaRef.cpp @@ -306,6 +306,7 @@ void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteele basis[5]=gauss->coord3*(1.+zeta)/2.; basis[6]=27.*gauss->coord1*gauss->coord2*gauss->coord3*(1.+zeta)*(1.-zeta); return; + #ifndef _HAVE_AD_ /*speed up CoDiPack Compilation by hiding higher order elements*/ case P2xP1Enum: /*Corner nodes*/ basis[ 0]=gauss->coord1*(2.*gauss->coord1-1.)*(1.-zeta)/2.; @@ -458,6 +459,7 @@ void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteele basis[13]=gauss->coord2*(-8./3.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.); basis[14]=gauss->coord3*(-8./3.)*(zeta-1.0)*zeta*(zeta+0.5)*(zeta+1.); return; + #endif default: _error_("Element type "<coord1*gauss->coord2; return; #endif + #ifndef _HAVE_AD_ /*speed up CoDiPack Compilation by hiding higher order elements*/ case P1xP2Enum: /*Nodal function 1*/ dbasis[NUMNODESP1xP2*0+0] = -zeta*(zeta-1.)/4.; @@ -662,6 +665,7 @@ void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* g dbasis[NUMNODESP1xP2*1+8 ] = SQRT3/3.*(1.-zeta*zeta); dbasis[NUMNODESP1xP2*2+8 ] = -2.*zeta*gauss->coord3; return; + #endif #ifndef _HAVE_AD_ /*speed up CoDiPack Compilation by hiding higher order elements*/ case P2Enum: /*Nodal function 1*/ diff --git a/src/c/cores/balancethickness_core.cpp b/src/c/cores/balancethickness_core.cpp index f067f9ebe..1d05c62e5 100644 --- a/src/c/cores/balancethickness_core.cpp +++ b/src/c/cores/balancethickness_core.cpp @@ -29,7 +29,7 @@ void balancethickness_core(FemModel* femmodel){ } } - if(VerboseSolution()) _printf0_(" call computational core:\n"); + if(VerboseSolution()) _printf0_("computing balance thickness\n"); femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum); solutionsequence_linear(femmodel); diff --git a/src/c/cores/balancevelocity_core.cpp b/src/c/cores/balancevelocity_core.cpp index 7c8de13a1..3c0382721 100644 --- a/src/c/cores/balancevelocity_core.cpp +++ b/src/c/cores/balancevelocity_core.cpp @@ -26,7 +26,7 @@ void balancevelocity_core(FemModel* femmodel){ femmodel->parameters->SetParam(DrivingStressYEnum,InputToSmoothEnum); solutionsequence_linear(femmodel); - if(VerboseSolution()) _printf0_(" call computational core:\n"); + if(VerboseSolution()) _printf0_("computing balance velocities\n"); femmodel->SetCurrentConfiguration(BalancevelocityAnalysisEnum); solutionsequence_linear(femmodel); diff --git a/src/c/cores/controladm1qn3_core.cpp b/src/c/cores/controladm1qn3_core.cpp index 709d33eb7..4c6869752 100644 --- a/src/c/cores/controladm1qn3_core.cpp +++ b/src/c/cores/controladm1qn3_core.cpp @@ -185,6 +185,7 @@ void simul_ad(long* indic,long* n,double* X,double* pf,double* G,long izs[1],flo X[index] = X[index]*scaling_factors[c]; if(X[index]>XU[index]) X[index]=XU[index]; if(X[index](intn,"t"); -#else + #else IssmDouble* aX=xNew(intn); -#endif + #endif - #if defined(_HAVE_ADOLC_) if(my_rank==0){ for(int i=0;i(dependents); xDelete(totalgradient); - } /*====????*/ + } /*Constrain Gradient*/ IssmDouble Gnorm = 0.; diff --git a/src/c/cores/debris_core.cpp b/src/c/cores/debris_core.cpp index a5a0f462e..91c83d1e2 100644 --- a/src/c/cores/debris_core.cpp +++ b/src/c/cores/debris_core.cpp @@ -37,7 +37,6 @@ void debris_core(FemModel* femmodel){ /*{{{*/ surfaceslope_core(femmodel); /*Transport Debris*/ - if(VerboseSolution()) _printf0_(" call computational core\n"); femmodel->inputs->DuplicateInput(VxEnum,VxDebrisEnum); if(domaintype!=Domain2DverticalEnum){ femmodel->inputs->DuplicateInput(VyEnum,VyDebrisEnum); diff --git a/src/c/cores/love_core.cpp b/src/c/cores/love_core.cpp index b1d6aa3c9..6cda7fca5 100644 --- a/src/c/cores/love_core.cpp +++ b/src/c/cores/love_core.cpp @@ -365,13 +365,14 @@ template void postwidder_transform(doubletype* Love indf=(t*2*NTit)*(sh_nmax+1)+d; doubletype* LoveM = NULL; + doubletype zero = 0; // test variation across frequencies tested, something with little frequency dependence is not worth going through PW tranform // that transform would also be numerically unstable PW_test = abs((Lovef[indf+(2*NTit-1)*(sh_nmax+1)]-Lovef[indf])/Lovef[indf]); - if (PW_test==0){ //elastic or fluid response: Love(t) = Love(s), we can do an early return + if (PW_test==zero){ //elastic or fluid response: Love(t) = Love(s), we can do an early return Lovet[t*(sh_nmax+1)+d]=Lovef[indf]; return; } @@ -402,12 +403,11 @@ template void postwidder_transform(doubletype* Love }/*}}}*/ template doubletype HypergeomTableLookup(doubletype z1, doubletype alpha, IssmDouble* h1, IssmDouble* z, int nz, int nalpha){/*{{{*/ - int iz1, iz2, ialpha; - doubletype lincoef; + int iz1, iz2; doubletype hf,h00,h10, h01, h11, za, zd, ha, hb,hc,hd, m0,m1,t; doubletype dalpha=1.0/(nalpha-1); // alpha table resolution given 0 <= alpha <= 1 - ialpha= static_cast(DownCastVarToDouble(alpha/dalpha)); - lincoef=alpha/dalpha-ialpha;//linear fraction in [0;1] for alpha interpolation + int ialpha = static_cast(DownCastVarToDouble(alpha/dalpha)); + doubletype lincoef = alpha/dalpha - std::floor(DownCastVarToDouble(alpha/dalpha));//linear fraction in [0;1] for alpha interpolation iz1=nz; for (int i=0;iabs(z1)) { @@ -463,9 +463,9 @@ template doubletype HypergeomTableLookup(doubletype z1, do t=(z1-z[iz1])/(z[iz1+1]-z[iz1]); //cubic spline functions - h00=2*pow(t,3)-3*pow(t,2)+1; - h10=pow(t,3)-2*pow(t,2)+t; - h01=-2*pow(t,3)+3*pow(t,2); + h00=2.*pow(t,3)-3.*pow(t,2)+1.; + h10=pow(t,3)-2.*pow(t,2)+t; + h01=-2.*pow(t,3)+3.*pow(t,2); h11=pow(t,3)-pow(t,2); hf=h00*hb + h10*m0 + h01*hc + h11*m1; @@ -611,8 +611,9 @@ template void GetEarthRheology(doubletype* pla, dou doubletype mu0=matlitho->lame_mu[layer_index]; doubletype la0=matlitho->lame_lambda[layer_index]; int rheo=matlitho->rheologymodel[layer_index]; + doubletype zero = 0; - if (vi!=0 && omega!=0.0){ //take into account viscosity in the rigidity if the material isn't a perfect fluid + if (vi!=zero && omega!=zero){ //take into account viscosity in the rigidity if the material isn't a perfect fluid doubletype ka=la0 + 2.0/3.0*mu0; //Bulk modulus if (rheo==2){//EBM mu=muEBM(layer_index, omega, matlitho, femmodel); @@ -695,7 +696,8 @@ template void fill_yi_prefactor(doubletype* yi_pref doubletype frh,frhg0,fgr0,fgr,fn,rm0,rlm,flm; doubletype xmin,xmax,x,dr; - doubletype g,ro, issolid; + doubletype g,ro; + bool issolid; if (pomega) { //frequency and degree dependent terms /*{{{*/ doubletype la,mu; @@ -784,7 +786,7 @@ template void fill_yi_prefactor(doubletype* yi_pref nindex=nsteps*36+n*36; g=GetGravity(x*ra,layer_index,femmodel,matlitho,vars); - if(issolid==1){ + if(issolid){ yi_prefactor[nindex+ 1*6+3]= fn/x; // in dy[1*6+3] yi_prefactor[nindex+ 5*6+2]= -(fgr/g0*fn)/x; // in dy[5*6+2] yi_prefactor[nindex+ 5*6+4]= fn/(x*x); // in dy[5*6+4] @@ -816,7 +818,7 @@ template void fill_yi_prefactor(doubletype* yi_pref for (int n=0;n(x*ra,layer_index,femmodel,matlitho,vars); nindex=nsteps*36+n*36; - if(issolid==1){ + if(issolid){ yi_prefactor[nindex+ 1*6+5]= -frhg0; // in dy[1*6+5] yi_prefactor[nindex+ 2*6+0]= -1.0/x; // in dy[2*6+0] yi_prefactor[nindex+ 2*6+2]= 1.0/x; // in dy[2*6+2] @@ -839,7 +841,7 @@ template void fill_yi_prefactor(doubletype* yi_pref template void yi_derivatives(doubletype* dydx, doubletype* y, int layer_index, int n, doubletype* yi_prefactor, FemModel* femmodel, Matlitho* matlitho, LoveVariables* vars){ /*{{{*/ //computes yi derivatives at r=radius[layer_index]+ n/nstep*(radius[layer_index+1]-radius[layer_index]) - int issolid=matlitho->issolid[layer_index]; + bool issolid=matlitho->issolid[layer_index]; int iy,id,ny, nindex, nstep, nsteps; //femmodel->parameters->FindParam(&nstep,LoveIntStepsPerLayerEnum); @@ -1385,8 +1387,8 @@ template void solve_yi_system(doubletype* loveh, do //-- Resolution int* ipiv=xNewZeroInit(nyi); //pivot index vector - int info = 0;// error checker - int nrhs=1; // number of right hand size columns + int info = 0;// error checker + int nrhs=1; // number of right hand size columns allgesv(&nyi, &nrhs, yilocal, &lda, ipiv, rhslocal, &ldb, &info); @@ -1426,6 +1428,7 @@ template void solve_yi_system(doubletype* loveh, do doubletype loveh1s = rhslocal[nyi-3]; doubletype lovel1s = rhslocal[nyi-2]; doubletype lovek1s = rhslocal[nyi-1] - 1.0/(g0*ra); + doubletype zero = 0; loveratio = abs(loveh1/loveh1s); //ratio of center to surface love numbers, determines if we should remove layers if (abs(lovel1/lovel1s) < loveratio) loveratio = abs(lovel1/lovel1s); @@ -1440,7 +1443,7 @@ template void solve_yi_system(doubletype* loveh, do inverse laplace transform.*/ } - if (omega==0){ // if running elastic love_numbers, record at which degree we must delete layers, this way we synch layer deletion between cpus next time we calculate love numbers + if (omega==zero){ // if running elastic love_numbers, record at which degree we must delete layers, this way we synch layer deletion between cpus next time we calculate love numbers //We need to delete a layer and try again if the ratio between deepest love number to surface love number is too low (risk of underflow) or garbage if (loveratio<=underflow_tol || xIsNan(loveratio) || xIsInf(loveratio)) { vars->deg_layer_delete[starting_layer]=deg; diff --git a/src/c/cores/masstransport_core.cpp b/src/c/cores/masstransport_core.cpp index 18124202f..556b61f5c 100644 --- a/src/c/cores/masstransport_core.cpp +++ b/src/c/cores/masstransport_core.cpp @@ -55,7 +55,6 @@ void masstransport_core(FemModel* femmodel){ /*{{{*/ extrudefromtop_core(femmodel); } else{ - if(VerboseSolution()) _printf0_(" call computational core\n"); femmodel->parameters->SetParam(VxEnum,InputToDepthaverageInEnum); femmodel->parameters->SetParam(VxAverageEnum,InputToDepthaverageOutEnum); depthaverage_core(femmodel); diff --git a/src/c/cores/sampling_core.cpp b/src/c/cores/sampling_core.cpp index d8f767c1c..82bfccc5c 100644 --- a/src/c/cores/sampling_core.cpp +++ b/src/c/cores/sampling_core.cpp @@ -30,7 +30,6 @@ void sampling_core(FemModel* femmodel){ if(VerboseSolution()) _printf0_(" Generating random samples\n"); /*Generate random sample*/ - if(VerboseSolution()) _printf0_(" call computational core\n"); SamplingAnalysis* analysis = new SamplingAnalysis(); femmodel->SetCurrentConfiguration(SamplingAnalysisEnum); diff --git a/src/c/cores/sealevelchange_core.cpp b/src/c/cores/sealevelchange_core.cpp index 654ea307b..ccacee65e 100644 --- a/src/c/cores/sealevelchange_core.cpp +++ b/src/c/cores/sealevelchange_core.cpp @@ -34,8 +34,6 @@ void slc_geometry_cleanup(SealevelGeometry* slgeom, FemModel* femmodel); /*main cores:*/ void sealevelchange_core(FemModel* femmodel){ /*{{{*/ - SealevelGeometry* slgeom=NULL; - /*Start profiler*/ femmodel->profiler->Start(SLRCORE); @@ -55,7 +53,7 @@ void sealevelchange_core(FemModel* femmodel){ /*{{{*/ couplerinput_core(femmodel); /*run geometry core: */ - slgeom=sealevelchange_geometry(femmodel); + SealevelGeometry* slgeom=sealevelchange_geometry(femmodel); /*any external forcings?:*/ solidearthexternal_core(femmodel); @@ -545,7 +543,7 @@ void coupleroutput_core(FemModel* femmodel){ /*{{{*/ } } -}; /*}}}*/ +}/*}}}*/ void ivins_deformation_core(FemModel* femmodel){ /*{{{*/ int gsize; @@ -787,9 +785,7 @@ void sealevelchange_finalize(FemModel* femmodel) { /*{{{*/ return; }/*}}}*/ - - -void slc_geometry_cleanup(SealevelGeometry* slgeom, FemModel* femmodel){ /*{{{*/ +void slc_geometry_cleanup(SealevelGeometry* slgeom, FemModel* femmodel){ /*{{{*/ /*early return?:*/ if(slgeom==NULL) return; @@ -805,7 +801,7 @@ void slc_geometry_cleanup(SealevelGeometry* slgeom, FemModel* femmodel){ /*{{{* } /*}}}*/ /*subroutines:*/ -bool slcconvergence(IssmDouble* RSLg,IssmDouble* RSLg_old,IssmDouble eps_rel,IssmDouble eps_abs, IssmDouble totaloceanarea, FemModel* femmodel){ /*{{{*/ +bool slcconvergence(IssmDouble* RSLg,IssmDouble* RSLg_old,IssmDouble eps_rel,IssmDouble eps_abs, IssmDouble totaloceanarea, FemModel* femmodel){ /*{{{*/ int nel; bool converged=true; @@ -865,7 +861,7 @@ bool slcconvergence(IssmDouble* RSLg,IssmDouble* RSLg_old,IssmDouble eps_rel,Iss return converged; } /*}}}*/ -IssmDouble SealevelloadsOceanAverage(GrdLoads* loads, Vector* oceanareas, Vector* suboceanareas, IssmDouble totaloceanarea){ /*{{{*/ +IssmDouble SealevelloadsOceanAverage(GrdLoads* loads, Vector* oceanareas, Vector* suboceanareas, IssmDouble totaloceanarea){ /*{{{*/ IssmDouble sealevelloadsaverage; IssmDouble subsealevelloadsaverage; @@ -875,7 +871,7 @@ IssmDouble SealevelloadsOceanAverage(GrdLoads* loads, Vector* ocean return (sealevelloadsaverage+subsealevelloadsaverage)/totaloceanarea; } /*}}}*/ -void PolarMotion(IssmDouble* polarmotionvector, FemModel* femmodel,GrdLoads* loads, SealevelGeometry* slgeom, bool computefuture){ /*{{{*/ +void PolarMotion(IssmDouble* polarmotionvector, FemModel* femmodel,GrdLoads* loads, SealevelGeometry* slgeom, bool computefuture){ /*{{{*/ //The purpose of this routine is to get the polar motion vector m=(m1, m2, m3) induced by the GrdLoads IssmDouble S2coef[3]; IssmDouble* pmtf_col= NULL; @@ -1073,8 +1069,7 @@ void SealevelchangeUpdateViscousTimeSeries(FemModel* femmodel){ /*{{{*/ xDelete(viscoustimes); if (rotation) xDelete(viscouspolarmotion); } - -} +}/*}}}*/ void ConserveOceanMass(FemModel* femmodel,GrdLoads* loads, IssmDouble offset, SealevelGeometry* slgeom){ /*{{{*/ /*Shift sealevel loads by ocean average, only on ocean! :*/ @@ -1147,7 +1142,6 @@ void TransferForcing(FemModel* femmodel,int forcingenum){ /*{{{*/ femmodel->parameters->FindParam(&nummodels,NumModelsEnum); int my_rank=IssmComm::GetRank(); - /*retrieve the inter communicators that will be used to send data from each ice cap to the earth: */ if(modelid==earthid){ GenericParam* parcoms = dynamic_cast*>(femmodel->parameters->FindParamObject(IcecapToEarthCommEnum)); @@ -1198,7 +1192,7 @@ void TransferForcing(FemModel* femmodel,int forcingenum){ /*{{{*/ } } - /*On the earth model, consolidate all the forcings into one, and update the elements dataset accordingly: {{{*/ + /*On the earth model, consolidate all the forcings into one, and update the elements dataset accordingly*/ if(modelid==earthid){ /*Out of all the delta thicknesses, build one delta thickness vector made of all the ice cap contributions. @@ -1316,7 +1310,7 @@ void TransferSealevel(FemModel* femmodel,int forcingenum){ /*{{{*/ GetVectorFromInputsx(&forcingglobal,femmodel,forcingenum,VertexSIdEnum); } - /*Send the forcing to the ice caps:{{{*/ + /*Send the forcing to the ice caps*/ if(my_rank==0){ if(modelid==earthid){ @@ -1351,9 +1345,8 @@ void TransferSealevel(FemModel* femmodel,int forcingenum){ /*{{{*/ ISSM_MPI_Recv(forcing, nv, ISSM_MPI_DOUBLE, 0, modelid, fromcomm, &status); } } - /*}}}*/ - /*On each ice cap, spread the forcing across cpus, and update the elements dataset accordingly: {{{*/ + /*On each ice cap, spread the forcing across cpus, and update the elements dataset accordingly*/ if(modelid!=earthid){ ISSM_MPI_Bcast(&nv,1,ISSM_MPI_INT,0,IssmComm::GetComm()); @@ -1363,7 +1356,6 @@ void TransferSealevel(FemModel* femmodel,int forcingenum){ /*{{{*/ /*Plug into elements:*/ InputUpdateFromVectorx(femmodel,forcing,forcingenum,VertexSIdEnum); } - /*}}}*/ /*Free resources:*/ if(my_rank==0 && modelid==earthid){ diff --git a/src/c/cores/transient_core.cpp b/src/c/cores/transient_core.cpp index 6d6393e19..65650ac1e 100644 --- a/src/c/cores/transient_core.cpp +++ b/src/c/cores/transient_core.cpp @@ -78,10 +78,10 @@ void transient_core(FemModel* femmodel){/*{{{*/ femmodel->parameters->SetParam(step,StepEnum); if(VerboseSolution()){ - _printf0_("iteration " << step << "/" << ceil((finaltime-time)/dt)+step << \ - " time [yr]: " <= finaltime - (yts*DBL_EPSILON)) || step==1) save_results=true; diff --git a/src/c/datastructures/DataSet.h b/src/c/datastructures/DataSet.h index 04eaf8c81..7062678c9 100644 --- a/src/c/datastructures/DataSet.h +++ b/src/c/datastructures/DataSet.h @@ -8,8 +8,7 @@ class Object; class MarshallHandle; -/*! \brief Declaration of DataSet class - * +/* * Declaration of DataSet class. A DataSet is a Container of Objects. */ class DataSet{ diff --git a/src/c/datastructures/Object.h b/src/c/datastructures/Object.h index 0406ad9d4..1281c8644 100644 --- a/src/c/datastructures/Object.h +++ b/src/c/datastructures/Object.h @@ -1,7 +1,4 @@ /* - * Object.h: - * \brief prototype for abstract Object class - * \file Object.h * This prototype describes the Object class. This is an abstract class, parent * to any other objects (Quad, Tria, Node , etc ...), that can be included in a * DataSet. @@ -13,14 +10,13 @@ class Object { public: - - virtual ~Object(){}; - virtual void Echo()=0; - virtual void DeepEcho()=0; - virtual int Id()=0; - virtual int ObjectEnum()=0; - virtual Object* copy()=0; - virtual void Marshall(MarshallHandle* marshallhandle)=0; + virtual ~Object(){}; + virtual void Echo() = 0; + virtual void DeepEcho() = 0; + virtual int Id() = 0; + virtual int ObjectEnum() = 0; + virtual Object *copy() = 0; + virtual void Marshall(MarshallHandle *marshallhandle)=0; }; #endif diff --git a/src/c/main/EnvironmentInit.cpp b/src/c/main/EnvironmentInit.cpp index bdee3be59..2c9b01a15 100644 --- a/src/c/main/EnvironmentInit.cpp +++ b/src/c/main/EnvironmentInit.cpp @@ -26,9 +26,11 @@ ISSM_MPI_Comm EnvironmentInit(int argc,char** argv){ int my_rank = 0; ISSM_MPI_Comm_rank(comm,&my_rank); if(!my_rank) printf("\n"); - if(!my_rank) printf("%s version %s\n",PACKAGE_NAME,PACKAGE_VERSION); - if(!my_rank) printf("(GitHub: %s Documentation: %s)\n",PACKAGE_URL,PACKAGE_BUGREPORT); - if(!my_rank) printf("\n"); + if(!my_rank) printf("──────────────────────────────────────────────────────────────────────\n"); + if(!my_rank) printf("%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); + if(!my_rank) printf(" GitHub: %s\n", PACKAGE_BUGREPORT); + if(!my_rank) printf(" Documentation: %s\n", PACKAGE_URL); + if(!my_rank) printf("──────────────────────────────────────────────────────────────────────\n"); /*Return communicator*/ return comm; diff --git a/src/c/main/issm_slc.cpp b/src/c/main/issm_slc.cpp index 844c686f4..df1168dd3 100644 --- a/src/c/main/issm_slc.cpp +++ b/src/c/main/issm_slc.cpp @@ -8,18 +8,10 @@ int main(int argc,char **argv){ /*diverse:*/ - int nummodels; int* commsizes=NULL; int* rankzeros=NULL; - char** dirnames=NULL; - char** modelnames=NULL; - int modelid; - int earthid; int my_rank; - int count=0; - ISSM_MPI_Comm worldcomm; - ISSM_MPI_Comm modelcomm; - ISSM_MPI_Comm toearthcomm; + ISSM_MPI_Comm worldcomm,modelcomm,toearthcomm; ISSM_MPI_Comm* fromicecomms=NULL; /*Initialize exception trapping: */ @@ -31,28 +23,17 @@ int main(int argc,char **argv){ /*What is my rank?:*/ ISSM_MPI_Comm_rank(worldcomm,&my_rank); - /*How many models are we going to run (along with description and number of dedicated cores):{{{*/ - nummodels=(int) strtol(argv[4], (char **)NULL, 10); - commsizes=xNew(nummodels); - dirnames=xNew(nummodels); - modelnames=xNew(nummodels); - rankzeros=xNew(nummodels); + /*How many models are we going to run (along with description and number of dedicated cores)*/ + int nummodels=(int) strtol(argv[4], (char **)NULL, 10); + commsizes = xNew(nummodels); + rankzeros = xNew(nummodels); for(int i=0;i(strlen(argv[5+3*i])+1); - xMemCpy(string,argv[5+3*i],strlen(argv[5+3*i])+1); - dirnames[i]=string; - - string=xNew(strlen(argv[5+3*i+1])+1); - xMemCpy(string,argv[5+3*i+1],strlen(argv[5+3*i+1])+1); - modelnames[i]=string; - commsizes[i]=(int) strtol(argv[5+3*i+2], (char **)NULL, 10); } - /*Figure out which model each cpu will belong to: */ - count=0; + /*Figure out which model each cpu will belong to*/ + int count = 0; + int modelid = -1; for(int i=0;i=count && my_rank<(count+commsizes[i])){ modelid=i; @@ -60,43 +41,42 @@ int main(int argc,char **argv){ } count+=commsizes[i]; } + _assert_(modelid>=0); + /*Buil array of who is rank 0 of their own group:*/ - count=0; + count = 0; for(int i=0;i(nummodels-1); for(int i=0;i(4); arguments[0]=xNew(strlen(argv[0])+1); xMemCpy(arguments[0],argv[0],strlen(argv[0])+1); //executable name arguments[1]=xNew(strlen(argv[1])+1); xMemCpy(arguments[1],argv[1],strlen(argv[1])+1); //solution name arguments[2]=xNew(strlen(argv[5+3*modelid])+1); xMemCpy(arguments[2],argv[5+3*modelid],strlen(argv[5+3*modelid])+1); //directory name arguments[3]=xNew(strlen(argv[5+3*modelid+1])+1); xMemCpy(arguments[3],argv[5+3*modelid+1],strlen(argv[5+3*modelid+1])+1); //model name - /*}}}*/ /*Initialize femmodel from arguments provided command line: */ FemModel *femmodel = new FemModel(4,arguments,modelcomm); - xDelete(arguments[0]); - xDelete(arguments[1]); - xDelete(arguments[2]); - xDelete(arguments[3]); + for(int i=0;i<4;i++) xDelete(arguments[i]); xDelete(arguments); /*Now that the models are initialized, keep communicator information in the parameters datasets of each model: */ @@ -105,8 +85,12 @@ int main(int argc,char **argv){ femmodel->parameters->AddObject(new IntParam(ModelIdEnum,modelid)); femmodel->parameters->AddObject(new IntParam(EarthIdEnum,earthid)); femmodel->parameters->AddObject(new IntParam(IsSlcCouplingEnum,1)); - if(modelid==earthid) femmodel->parameters->AddObject(new GenericParam(fromicecomms,IcecapToEarthCommEnum)); - else femmodel->parameters->AddObject(new GenericParam(toearthcomm,IcecapToEarthCommEnum)); + if(modelid==earthid){ + femmodel->parameters->AddObject(new GenericParam(fromicecomms,IcecapToEarthCommEnum)); + } + else{ + femmodel->parameters->AddObject(new GenericParam(toearthcomm,IcecapToEarthCommEnum)); + } /*Solve: */ femmodel->Solve(); @@ -114,11 +98,9 @@ int main(int argc,char **argv){ /*Output results: */ OutputResultsx(femmodel); - /*Wrap up: */ + /*Free resources:*/ femmodel->CleanUp(); delete femmodel; - - /*Delete communicators */ ISSM_MPI_Comm_free(&modelcomm); if(modelid==earthid){ for(int i=0;i(string); - string=modelnames[i]; xDelete(string); - } - xDelete(dirnames); - xDelete(modelnames); - /*Return unix success: */ return 0; } diff --git a/src/c/main/kriging.cpp b/src/c/main/kriging.cpp index 9ad755414..c38564293 100644 --- a/src/c/main/kriging.cpp +++ b/src/c/main/kriging.cpp @@ -47,7 +47,7 @@ int main(int argc,char **argv){ ProcessInputfile(&x,&y,&data,&nobs,&x_interp,&y_interp,&ninterp,&options,input_fid); pfclose(input_fid,binfilename); - _printf0_("call computational core:\n"); + _printf0_("computing predictions\n"); pKrigingx(&predictions,&error,x,y,data,nobs,x_interp,y_interp,ninterp,options); _printf0_("write results to disk:\n"); diff --git a/src/c/modules/Krigingx/Krigingx.cpp b/src/c/modules/Krigingx/Krigingx.cpp index 1a3a7aaa6..ffe1e65e1 100644 --- a/src/c/modules/Krigingx/Krigingx.cpp +++ b/src/c/modules/Krigingx/Krigingx.cpp @@ -110,7 +110,7 @@ int Krigingx(double** ppredictions,double **perror,double* obs_x, double* obs_ /*launch the thread manager with Krigingxt as a core: */ LaunchThread(NearestNeighbort,(void*)&gate,num); - printf("\r interpolation progress: 100%%\n"); + printf("\r interpolation progress: 100%% \n"); xDelete(gate.numdone); } else if(strcmp(output,"idw")==0){ //Inverse distance weighting @@ -132,7 +132,7 @@ int Krigingx(double** ppredictions,double **perror,double* obs_x, double* obs_ /*launch the thread manager with Krigingxt as a core: */ LaunchThread(idwt,(void*)&gate,num); - printf("\r interpolation progress: 100%%\n"); + printf("\r interpolation progress: 100%% \n"); xDelete(gate.numdone); } else if(strcmp(output,"v4")==0){ //Inverse distance weighting @@ -154,7 +154,7 @@ int Krigingx(double** ppredictions,double **perror,double* obs_x, double* obs_ /*launch the thread manager with Krigingxt as a core: */ LaunchThread(v4t,(void*)&gate,num); - printf("\r interpolation progress: 100%%\n"); + printf("\r interpolation progress: 100%% \n"); xDelete(gate.numdone); } else if(strcmp(output,"prediction")==0){ @@ -177,7 +177,7 @@ int Krigingx(double** ppredictions,double **perror,double* obs_x, double* obs_ /*launch the thread manager with Krigingxt as a core: */ LaunchThread(Krigingxt,(void*)&gate,num); - printf("\r interpolation progress: 100%%\n"); + printf("\r interpolation progress: 100%% \n"); xDelete(gate.numdone); } else{ @@ -229,7 +229,7 @@ void* Krigingxt(void* vpthread_handle){/*{{{*/ if(my_thread==0){ int alldone=numdone[0]; for(int i=1;iInterpolationNearestNeighbor(&predictions[idx],x_interp[idx],y_interp[idx],radius); @@ -321,7 +321,7 @@ void* idwt(void* vpthread_handle){/*{{{*/ if(my_thread==0){ int alldone=numdone[0]; for(int i=1;iInterpolationIDW(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata,power); @@ -365,7 +365,7 @@ void* v4t(void* vpthread_handle){/*{{{*/ if(my_thread==0){ int alldone=numdone[0]; for(int i=1;iInterpolationV4(&predictions[idx],x_interp[idx],y_interp[idx],radius,mindata,maxdata); diff --git a/src/c/modules/Scotchx/Scotchx.cpp b/src/c/modules/Scotchx/Scotchx.cpp deleted file mode 100644 index 996fd22f3..000000000 --- a/src/c/modules/Scotchx/Scotchx.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/* Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS -** -** This file is part of the Scotch software package for static mapping, -** graph partitioning and sparse matrix ordering. -** -** This software is governed by the CeCILL-C license under French law -** and abiding by the rules of distribution of free software. You can -** use, modify and/or redistribute the software under the terms of the -** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following -** URL: "http://www.cecill.info". -** -** As a counterpart to the access to the source code and rights to copy, -** modify and redistribute granted by the license, users are provided -** only with a limited warranty and the software's author, the holder of -** the economic rights, and the successive licensors have only limited -** liability. -** -** In this respect, the user's attention is drawn to the risks associated -** with loading, using, modifying and/or developing or reproducing the -** software by the user in light of its specific status of free software, -** that may mean that it is complicated to manipulate, and that also -** therefore means that it is reserved for developers and experienced -** professionals having in-depth computer knowledge. Users are therefore -** encouraged to load and test the software's suitability as regards -** their requirements in conditions enabling the security of their -** systems and/or data to be ensured and, more generally, to use and -** operate it in the same conditions as regards security. -** -** The fact that you are presently reading this means that you have had -** knowledge of the CeCILL-C license and that you accept its terms. -*/ -/************************************************************/ -/** **/ -/** NAME : gmap.c **/ -/** **/ -/** AUTHOR : Francois PELLEGRINI **/ -/** **/ -/** FUNCTION : Part of a graph mapping software. **/ -/** This module contains the main function. **/ -/** **/ -/** DATES : # Version 0.0 : from : 05 jan 1993 **/ -/** to 12 may 1993 **/ -/** # Version 1.1 : from : 15 oct 1993 **/ -/** to 15 oct 1993 **/ -/** # Version 1.3 : from : 06 apr 1994 **/ -/** to 18 may 1994 **/ -/** # Version 2.0 : from : 06 jun 1994 **/ -/** to 17 nov 1994 **/ -/** # Version 2.1 : from : 07 apr 1995 **/ -/** to 18 jun 1995 **/ -/** # Version 3.0 : from : 01 jul 1995 **/ -/** to 02 oct 1995 **/ -/** # Version 3.1 : from : 07 nov 1995 **/ -/** to 25 apr 1996 **/ -/** # Version 3.2 : from : 24 sep 1996 **/ -/** to 26 may 1998 **/ -/** # Version 3.3 : from : 19 oct 1998 **/ -/** to : 30 mar 1999 **/ -/** # Version 3.4 : from : 03 feb 2000 **/ -/** to : 03 feb 2000 **/ -/** # Version 4.0 : from : 16 jan 2004 **/ -/** to : 27 dec 2004 **/ -/** # Version 5.0 : from : 23 dec 2007 **/ -/** to : 18 jun 2008 **/ -/** **/ -/************************************************************/ - -#include "./Scotchx.h" - -int -gmapx ( - int (**pmaptabi)[2], - int argcm, - char *argvm[], - int nvi, - int ne2i, - int *ir, - int *jc, - int *vli, - int *vwi, - int *ewi, - char archtyp[], - int nai, - int *api) -{ -#ifdef _HAVE_SCOTCH_ //only works if Scotch library has been compiled in. - - SCOTCH_Graph grafdat; /* Source graph */ - SCOTCH_Num grafflag; /* Source graph properties */ - SCOTCH_Arch archdat; /* Target architecture */ - SCOTCH_Strat stradat; /* Mapping strategy */ - SCOTCH_Mapping mapdat; /* Mapping data */ - Clock runtime[2]; /* Timing variables */ - SCOTCH_Num nvert =0; - SCOTCH_Num nedge2=0; - SCOTCH_Num* adjir =NULL; - SCOTCH_Num* adjjc =NULL; - SCOTCH_Num* vertlab=NULL; - SCOTCH_Num* vertwgt=NULL; - SCOTCH_Num* edgewgt=NULL; - SCOTCH_Num napar =0; - SCOTCH_Num* archpar=NULL; - SCOTCH_Num (*maptab)[2]=NULL; - int (*maptabi)[2]=NULL; - int flagval; - int i,j,k; - -/* reset static variables from previous runs (jes, 4/27/10) */ - - C_partNbr = 2; /* Default number of parts */ - C_paraNum = 0; /* Number of parameters */ - C_paraNbr = 0; /* No parameters for mapping */ - C_fileNum = 0; /* Number of file in arg list */ - C_fileNbr = 4; /* Number of files for mapping */ - for (i=0; i= 5) && (strncmp (argvm[0] + i - 5, "gpart", 5) == 0)) { - flagval |= C_FLAGPART; - C_paraNbr = 1; /* One more parameter */ - C_fileNbr = 3; /* One less file to provide */ - errorProg ("gpart"); - } - else - errorProg ("gmap"); - - intRandResetStatic (); - intRandInit (); - - if ((argcm >= 2) && (argvm[1][0] == '?')) { /* If need for help */ - usagePrint (stdout, C_usageList); - return (0); - } - - grafflag = 0; /* Use vertex and edge weights */ - SCOTCH_stratInit (&stradat); /* Set default mapping strategy */ - - for (i = 0; i < C_FILENBR; i ++) /* Set default stream pointers */ - C_fileTab[i].pntr = (C_fileTab[i].mode[0] == 'r') ? stdin : stdout; - for (i = 1; i < argcm; i ++) { /* Loop for all option codes */ - if ((argvm[i][0] != '-') || (argvm[i][1] == '\0') || (argvm[i][1] == '.')) { /* If found a file name */ - if (C_paraNum < C_paraNbr) { /* If number of parameters not reached */ - if ((C_partNbr = atoi (argvm[i])) < 1) /* Get the number of parts */ - errorPrint ("main: invalid number of parts (\"%s\")", argvm[i]); - C_paraNum ++; - continue; /* Process the other parameters */ - } - if (C_fileNum < C_fileNbr) /* A file name has been given */ - C_fileTab[C_fileNum ++].name = argvm[i]; - else - errorPrint ("main: too many file names given"); - } - else { /* If found an option name */ - switch (argvm[i][1]) { - case 'H' : /* Give the usage message */ - case 'h' : - usagePrint (stdout, C_usageList); - return (0); - case 'M' : - case 'm' : - SCOTCH_stratExit (&stradat); - SCOTCH_stratInit (&stradat); - SCOTCH_stratGraphMap (&stradat, &argvm[i][2]); - break; - case 'S' : - case 's' : /* Source graph parameters */ - for (j = 2; argvm[i][j] != '\0'; j ++) { - switch (argvm[i][j]) { - case 'E' : - case 'e' : - grafflag |= 2; /* Do not load edge weights */ - break; - case 'V' : - case 'v' : - grafflag |= 1; /* Do not load vertex weights */ - break; - default : - errorPrint ("main: invalid source graph option (\"%c\")", argvm[i][j]); - } - } - break; - case 'V' : - fprintf (stderr, "gmap/gpart, version %s - F. Pellegrini\n", SCOTCH_VERSION); - fprintf (stderr, "Copyright 2004,2007,2008 ENSEIRB, INRIA & CNRS, France\n"); - fprintf (stderr, "This software is libre/free software under CeCILL-C -- see the user's manual for more information\n"); - return (0); - case 'v' : /* Output control info */ - for (j = 2; argvm[i][j] != '\0'; j ++) { - switch (argvm[i][j]) { - case 'M' : - case 'm' : - flagval |= C_FLAGVERBMAP; - break; - case 'S' : - case 's' : - flagval |= C_FLAGVERBSTR; - break; - case 'T' : - case 't' : - flagval |= C_FLAGVERBTIM; - break; - default : - errorPrint ("main: unprocessed parameter \"%c\" in \"%s\"", argvm[i][j], argvm[i]); - } - } - break; - default : - errorPrint ("main: unprocessed option (\"%s\")", argvm[i]); - } - } - } - if ((flagval && C_FLAGPART) != 0) { /* If program run as the partitioner */ - C_fileTab[3].name = C_fileTab[2].name; /* Put provided file names at their right place */ - C_fileTab[2].name = C_fileTab[1].name; - C_fileTab[1].name = "-"; - } - - fileBlockOpen (C_fileTab, C_FILENBR); /* Open all files */ - - clockInit (&runtime[0]); - clockStart (&runtime[0]); - - SCOTCH_graphInit (&grafdat); /* Create graph structure */ - SCOTCH_graphLoad (&grafdat, C_filepntrsrcinp, -1, grafflag, nvert, nedge2, adjir, adjjc, vertlab, vertwgt, edgewgt); /* Read source graph */ - - SCOTCH_archInit (&archdat); /* Create architecture structure */ - if ((flagval & C_FLAGPART) != 0) /* If program run as the partitioner */ - SCOTCH_archCmplt (&archdat, C_partNbr); /* Create a complete graph of proper size */ - else - SCOTCH_archLoad (&archdat, C_filepntrtgtinp, archtyp, napar, archpar); /* Read target architecture */ - - clockStop (&runtime[0]); /* Get input time */ - clockInit (&runtime[1]); - clockStart (&runtime[1]); - - SCOTCH_graphMapInit (&grafdat, &mapdat, &archdat, NULL); - SCOTCH_graphMapCompute (&grafdat, &mapdat, &stradat); /* Perform mapping */ - - clockStop (&runtime[1]); /* Get computation time */ - clockStart (&runtime[0]); - - SCOTCH_graphMapSave (&nvert, &maptab, &grafdat, &mapdat, C_filepntrmapout); /* Write mapping */ - -/* convert output arguments from scotch data types */ - - if (maptab) { - *pmaptabi = (int (*)[2]) malloc(nvert*2*sizeof(int)); - maptabi = *pmaptabi; - for (j=0; j<2; j++) - for (i=0; i -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include -#include -#include "../../classes/classes.h" - -#ifdef _HAVE_SCOTCH_ //only works if scotch library has been compiled in. - - #define GMAP - - #ifdef _PETSC_SCOTCH_ - #include "scotch_module.h" - #include "scotch_common.h" - #include "scotch_gmap.h" - #endif - - #ifdef _HAVE_MPI_ - #include "ptscotch.h" - #else - #include "scotch.h" - #endif - - /* - ** The static variables. - */ - - static int C_partNbr = 2; /* Default number of parts */ - static int C_paraNum = 0; /* Number of parameters */ - static int C_paraNbr = 0; /* No parameters for mapping */ - static int C_fileNum = 0; /* Number of file in arg list */ - static int C_fileNbr = 4; /* Number of files for mapping */ - static File C_fileTab[C_FILENBR] = { /* File array */ - { "-", NULL, "r" }, - { "-", NULL, "r" }, - { "-", NULL, "w" }, - { "-", NULL, "w" } }; - - static const char * C_usageList[] = { /* Usage */ - "gmap [ [ [ []]]] ", - "gpart [] [ [ []]] ", - " -h : Display this help", - " -m : Set mapping strategy (see user's manual)", - " -s : Force unity weights on :", - " e : edges", - " v : vertices", - " -V : Print program version and copyright", - " -v : Set verbose mode to :", - " m : mapping information", - " s : strategy information", - " t : timing information", - "", - "See default strategy with option '-vs'", - NULL }; - -#endif - -/* local prototypes: */ -int gmapx ( int (**pmaptabi)[2], int argcm, char *argvm[], int nvi, int ne2i, int *ir, int *jc, int *vli, int *vwi, int *ewi, char archtyp[], int nai, int *api); - -#endif /* _SCOTCHX_H */ diff --git a/src/c/modules/Solverx/Solverx.cpp b/src/c/modules/Solverx/Solverx.cpp index 31bedefc8..7af1798b1 100644 --- a/src/c/modules/Solverx/Solverx.cpp +++ b/src/c/modules/Solverx/Solverx.cpp @@ -17,16 +17,25 @@ void Solverx(Vector** puf, Matrix* Kff, Vector* solver=new Solver(Kff,pf,uf0,df,parameters); + #if defined(_HAVE_CODIPACK_) + auto& tape = IssmDouble::getTape(); + auto pos = tape.getPosition(); + #endif + /*Solve:*/ if(VerboseModule()) _printf0_(" Solving matrix system\n"); Vector* uf=solver->Solve(); /*Check convergence, if failed, try recovery model*/ if(!checkconvergence(Kff,pf,uf,parameters)){ - _printf0_("WARNING: Solver failed, Trying Recovery Mode\n"); - ToolkitsOptionsFromAnalysis(parameters,RecoveryAnalysisEnum); delete uf; + + #if defined(_HAVE_CODIPACK_) + tape.resetTo(pos); + #endif + + ToolkitsOptionsFromAnalysis(parameters,RecoveryAnalysisEnum); uf=solver->Solve(); if(!checkconvergence(Kff,pf,uf,parameters)) _error_("Recovery solver failed..."); diff --git a/src/c/modules/modules.h b/src/c/modules/modules.h index 8cce47561..61c00f974 100644 --- a/src/c/modules/modules.h +++ b/src/c/modules/modules.h @@ -83,7 +83,6 @@ #include "./ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.h" #include "./RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h" #include "./RheologyBAbsGradientx/RheologyBAbsGradientx.h" -#include "./Scotchx/Scotchx.h" #include "./StochasticForcingx/StochasticForcingx.h" #include "./SurfaceMassBalancex/SurfaceMassBalancex.h" #include "./Solverx/Solverx.h" diff --git a/src/c/shared/Enum/EnumDefinitions.h b/src/c/shared/Enum/EnumDefinitions.h index e0eadcd7b..013464a4a 100644 --- a/src/c/shared/Enum/EnumDefinitions.h +++ b/src/c/shared/Enum/EnumDefinitions.h @@ -208,6 +208,8 @@ enum definitions{ FrictionDNNEnum, FrictionDNNpsEnum, FrictionDNNstEnum, + FrictionDNNInputScaleEnum, + FrictionDNNOutputScaleEnum, FrictionEffectivePressureLimitEnum, FrictionFEnum, FrictionGammaEnum, diff --git a/src/m/classes/autodiff.m b/src/m/classes/autodiff.m index 67270b2c4..87e9a5f7e 100644 --- a/src/m/classes/autodiff.m +++ b/src/m/classes/autodiff.m @@ -112,8 +112,7 @@ function marshall(self,prefix,md,fid) % {{{ return; end - - %buffer sizes {{{ + %buffer sizes WriteData(fid,prefix,'object',self,'fieldname','obufsize','format','Double'); WriteData(fid,prefix,'object',self,'fieldname','lbufsize','format','Double'); WriteData(fid,prefix,'object',self,'fieldname','cbufsize','format','Double'); @@ -121,19 +120,17 @@ function marshall(self,prefix,md,fid) % {{{ WriteData(fid,prefix,'object',self,'fieldname','gcTriggerRatio','format','Double'); WriteData(fid,prefix,'object',self,'fieldname','gcTriggerMaxSize','format','Double'); WriteData(fid,prefix,'object',self,'fieldname','tapeAlloc','format','Integer'); - %}}} - %output of memory and time {{{ + + %output of memory and time WriteData(fid,prefix,'object',self,'fieldname','outputTapeMemory','format','Boolean'); WriteData(fid,prefix,'object',self,'fieldname','outputTime','format','Boolean'); - %}}} - %memory reduction options {{{ + + %memory reduction options WriteData(fid,prefix,'object',self,'fieldname','enablePreaccumulation','format','Boolean'); - %}}} - %process dependent variables {{{ + %process dependent variables num_dependent_objects=numel(self.dependents); WriteData(fid,prefix,'data',num_dependent_objects,'name','md.autodiff.num_dependent_objects','format','Integer'); - - if(num_dependent_objects), + if(num_dependent_objects) names={}; for i=1:num_dependent_objects, dep=self.dependents{i}; @@ -141,8 +138,8 @@ function marshall(self,prefix,md,fid) % {{{ end WriteData(fid,prefix,'data',names,'name','md.autodiff.dependent_object_names','format','StringArray'); end - %}}} - %process independent variables {{{ + + %process independent variables num_independent_objects=numel(self.independents); WriteData(fid,prefix,'data',num_independent_objects,'name','md.autodiff.num_independent_objects','format','Integer'); for i=1:num_independent_objects @@ -153,11 +150,10 @@ function marshall(self,prefix,md,fid) % {{{ WriteData(fid,prefix,'data',indep.control_scaling_factor,'name','md.autodiff.independent_scaling_factor','format','Double'); WriteData(fid,prefix,'data',indep.control_size,'name','md.autodiff.independent_control_size','format','Integer'); end - %}}} - %if driver is fos_forward, build index: {{{ - if strcmpi(self.driver,'fos_forward'), - index=0; + %if driver is fos_forward, build inde + if strcmpi(self.driver,'fos_forward') + index=0; for i=1:num_independent_objects, indep=self.independents{i}; if ~isnan(indep.fos_forward_index), @@ -174,8 +170,8 @@ function marshall(self,prefix,md,fid) % {{{ index=index-1; %get c-index numbering going WriteData(fid,prefix,'data',index,'name','md.autodiff.fos_forward_index','format','Integer'); end - %}}} - %if driver is fos_reverse, build index: {{{ + + %if driver is fos_reverse, build index: if strcmpi(self.driver,'fos_reverse'), index=0; @@ -191,8 +187,8 @@ function marshall(self,prefix,md,fid) % {{{ index=index-1; %get c-index numbering going WriteData(fid,prefix,'data',index,'name','md.autodiff.fos_reverse_index','format','Integer'); end - %}}} - %if driver is fov_forward, build indices: {{{ + + %if driver is fov_forward, build indices if strcmpi(self.driver,'fov_forward'), indices=0; @@ -212,8 +208,8 @@ function marshall(self,prefix,md,fid) % {{{ indices=indices-1; %get c-indices numbering going WriteData(fid,prefix,'data',indices,'name','md.autodiff.fov_forward_indices','format','IntMat','mattype',3); end - %}}} - %deal with mass fluxes: {{{ + + %deal with mass fluxes mass_flux_segments=cell(0,1); for i=1:num_dependent_objects, dep=self.dependents{i}; @@ -228,8 +224,8 @@ function marshall(self,prefix,md,fid) % {{{ flag=false; end WriteData(fid,prefix,'data',flag,'name','md.autodiff.mass_flux_segments_present','format','Boolean'); - %}}} - %deal with trace keep on: {{{ + + %deal with trace keep on keep=false; %From ADOLC userdoc: @@ -249,7 +245,6 @@ function marshall(self,prefix,md,fid) % {{{ end end WriteData(fid,prefix,'data',keep,'name','md.autodiff.keep','format','Boolean'); - %}}} end % }}} function savemodeljs(self,fid,modelname) % {{{ diff --git a/src/m/classes/basalforcingsbeckmanngoosse.m b/src/m/classes/basalforcingsbeckmanngoosse.m index ccae63fb5..d791ee429 100644 --- a/src/m/classes/basalforcingsbeckmanngoosse.m +++ b/src/m/classes/basalforcingsbeckmanngoosse.m @@ -81,7 +81,7 @@ function createxml(self,fid) % {{{ if ismember('MasstransportAnalysis',analyses) & ~(solution=='TransientSolution' & md.transient.ismasstransport==0), md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1); - md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'universal',1,'NaN',1,'Inf',1); + md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'size','universal','NaN',1,'Inf',1); md = checkfield(md,'fieldname','basalforcings.isthermalforcing','values',[0 1]); if(self.isthermalforcing==0) md = checkfield(md,'fieldname','basalforcings.ocean_temp','NaN',1,'Inf',1,'timeseries',1); @@ -92,7 +92,7 @@ function createxml(self,fid) % {{{ end if ismember('BalancethicknessAnalysis',analyses), md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]); - md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'universal',1,'NaN',1,'Inf',1); + md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'size','universal','NaN',1,'Inf',1); md = checkfield(md,'fieldname','basalforcings.isthermalforcing','values',[0 1]); if(self.isthermalforcing==0) md = checkfield(md,'fieldname','basalforcings.ocean_temp','NaN',1,'Inf',1,'timeseries',1); @@ -104,7 +104,7 @@ function createxml(self,fid) % {{{ if ismember('ThermalAnalysis',analyses) & ~(solution=='TransientSolution' & md.transient.isthermal==0), md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1); md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'timeseries',1,'>=',0); - md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'universal',1,'NaN',1,'Inf',1); + md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'size','universal','NaN',1,'Inf',1); end end % }}} function disp(self) % {{{ diff --git a/src/m/classes/clusters/acenet.m b/src/m/classes/clusters/acenet.m index b1874f332..65ea2b14a 100644 --- a/src/m/classes/clusters/acenet.m +++ b/src/m/classes/clusters/acenet.m @@ -142,14 +142,14 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/aci.m b/src/m/classes/clusters/aci.m old mode 100755 new mode 100644 index e30b42672..816dbc5a2 --- a/src/m/classes/clusters/aci.m +++ b/src/m/classes/clusters/aci.m @@ -91,13 +91,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/andes.m b/src/m/classes/clusters/andes.m index 76873e6b3..90ea5eba7 100644 --- a/src/m/classes/clusters/andes.m +++ b/src/m/classes/clusters/andes.m @@ -143,13 +143,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,0,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/aurora.m b/src/m/classes/clusters/aurora.m index 6356d1746..cb0742bbf 100644 --- a/src/m/classes/clusters/aurora.m +++ b/src/m/classes/clusters/aurora.m @@ -109,7 +109,7 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} @@ -122,7 +122,7 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && qsub ' modelname '.queue ']; end - disp('launching solution sequence on remote cluster'); + %Execute Queue job issmssh(cluster.name,cluster.login,cluster.port,launchcommand); end %}}} diff --git a/src/m/classes/clusters/aws_issm_solution_server.m b/src/m/classes/clusters/aws_issm_solution_server.m index acce93c4d..183861aaa 100644 --- a/src/m/classes/clusters/aws_issm_solution_server.m +++ b/src/m/classes/clusters/aws_issm_solution_server.m @@ -148,7 +148,7 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files if cluster.interactive==10, directory=[pwd() '/run/']; elseif cluster.interactive, @@ -187,7 +187,7 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ end end - disp('launching solution sequence on remote cluster'); + %Execute Queue job %NOTE: Replacement for issmssh(cluster.name,cluster.login,cluster.port,launchcommand); launchstring=['ssh -l ' cluster.login ' -i ' cluster.idfile ' ' cluster.name ' "' launchcommand '"']; [status,result]=system(launchstring); diff --git a/src/m/classes/clusters/camhpc.m b/src/m/classes/clusters/camhpc.m index 7070f3be3..721df760f 100644 --- a/src/m/classes/clusters/camhpc.m +++ b/src/m/classes/clusters/camhpc.m @@ -123,13 +123,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job % % qsub replaced by sbatch for csd3 system NSA 28/3/18 if ~isempty(restart) diff --git a/src/m/classes/clusters/castor.m b/src/m/classes/clusters/castor.m index 04d68520a..0fcd22556 100644 --- a/src/m/classes/clusters/castor.m +++ b/src/m/classes/clusters/castor.m @@ -81,13 +81,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/cloud.m b/src/m/classes/clusters/cloud.m index aeef9c6d5..50522f434 100644 --- a/src/m/classes/clusters/cloud.m +++ b/src/m/classes/clusters/cloud.m @@ -69,7 +69,7 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ if isempty(cluster.login), error('cloud BuildQueueScript: login should be supplied!'); end - disp('uploading input file and queuing script'); + %upload input files issmstscpout(cluster.name,cluster.executionpath,cluster.login,{[dirname '.tar.gz']}); end %}}} @@ -84,7 +84,7 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz']; end else - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue']; else diff --git a/src/m/classes/clusters/cloud.py b/src/m/classes/clusters/cloud.py index 56a557e19..dc263b7a0 100644 --- a/src/m/classes/clusters/cloud.py +++ b/src/m/classes/clusters/cloud.py @@ -74,7 +74,7 @@ def UploadQueueJob(self, modelname, dirname, filelist): # {{{ if isempty(self.login): raise Exception('cloud BuildQueueScript: login should be supplied!') - print('uploading input file and queuing script') + #upload input files issmstscpout(self.name, self.executionpath, self.login, '{}.tar.gz'.format(dirname)) # }}} @@ -86,7 +86,7 @@ def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ else: launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname) else: - print('launching solution sequence on remote cluster') + #Execute Queue job if not isempty(restart): launchcommand = 'cd {} && cd {} && qsub {}.queue'.format(self.executionpath, dirname, modelname) else: diff --git a/src/m/classes/clusters/computecanada.m b/src/m/classes/clusters/computecanada.m index c094ec10f..fab6408a1 100644 --- a/src/m/classes/clusters/computecanada.m +++ b/src/m/classes/clusters/computecanada.m @@ -109,13 +109,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}, 0, 2); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/cosmos.m b/src/m/classes/clusters/cosmos.m index d99dbb062..227b6a899 100644 --- a/src/m/classes/clusters/cosmos.m +++ b/src/m/classes/clusters/cosmos.m @@ -81,13 +81,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/cyclone.py b/src/m/classes/clusters/cyclone.py index 2f5f20cb8..b507434e8 100644 --- a/src/m/classes/clusters/cyclone.py +++ b/src/m/classes/clusters/cyclone.py @@ -92,11 +92,11 @@ def UploadQueueJob(self, modelname, dirname, filelist): # {{{ compressstring += ' {}'.format(file) subprocess.call(compressstring, shell=True) - print('uploading input file and queuing script') + #upload input files issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz']) # }}} def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ - print('launching solution sequence on remote cluster') + #Execute Queue job if not isempty(restart): launchcommand = 'cd %s && cd %s && qsub %s.queue' % (self.executionpath, dirname, modelname) else: diff --git a/src/m/classes/clusters/discover.m b/src/m/classes/clusters/discover.m index c491ab14d..a199c8125 100644 --- a/src/m/classes/clusters/discover.m +++ b/src/m/classes/clusters/discover.m @@ -172,7 +172,7 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files if cluster.interactive, directory=[cluster.executionpath '/Interactive' num2str(cluster.interactive)]; else @@ -204,7 +204,7 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ end end - disp('launching solution sequence on remote cluster'); + %Execute Queue job issmssh(cluster.name,cluster.login,cluster.port,launchcommand); end %}}} diff --git a/src/m/classes/clusters/discover.py b/src/m/classes/clusters/discover.py index f7440d90e..05d7d637a 100644 --- a/src/m/classes/clusters/discover.py +++ b/src/m/classes/clusters/discover.py @@ -180,7 +180,7 @@ def UploadQueueJob(self, modelname, dirname, filelist): # {{{ compressstring += ' {}.run {}.errlog {}.outlog'.format(modelname, modelname, modelname) subprocess.call(compressstring, shell=True) - print('uploading input file and queuing script') + #upload input files if self.interactive: directory = '{}/Interactive{}'.format(self.executionpath, self.interactive) else: @@ -204,7 +204,7 @@ def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ else: launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz && sbatch {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname) - print('launching solution sequence on remote cluster') + #Execute Queue job issmssh(self.name, self.login, self.port, launchcommand) # }}} diff --git a/src/m/classes/clusters/discovery.m b/src/m/classes/clusters/discovery.m index 8e5a0c973..a9a2b3a18 100644 --- a/src/m/classes/clusters/discovery.m +++ b/src/m/classes/clusters/discovery.m @@ -153,13 +153,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,0,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/eis_nasa_smce.py b/src/m/classes/clusters/eis_nasa_smce.py index cf7ff680b..e41339515 100644 --- a/src/m/classes/clusters/eis_nasa_smce.py +++ b/src/m/classes/clusters/eis_nasa_smce.py @@ -200,7 +200,7 @@ def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ else: launchcommand = 'cd {} && rm -rf {} && mkdir {} && cd {} && cp /efs/issm/tmp/{}.tar.gz . && tar -zxf {}.tar.gz && /opt/slurm/bin/sbatch {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname) - print('launching solution sequence on remote cluster') + #Execute Queue job # NOTE: Replacement for issmssh(self.name, self.login, self.port, launchcommand) subprocess.call('ssh -l {} -i {} {} "{}"'.format(self.login, self.idfile, self.name, launchcommand), shell=True) diff --git a/src/m/classes/clusters/fram.py b/src/m/classes/clusters/fram.py index 7279cfb80..9f612fa10 100644 --- a/src/m/classes/clusters/fram.py +++ b/src/m/classes/clusters/fram.py @@ -143,12 +143,12 @@ def UploadQueueJob(self, modelname, dirname, filelist): # {{{ compressstring += ' {}'.format(file) subprocess.call(compressstring, shell=True) - print('uploading input file and queuing script') + #upload input files issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz']) # }}} def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ - print('launching solution sequence on remote cluster') + #Execute Queue job if not isempty(restart): launchcommand = 'cd %s && cd %s && sbatch %s.queue' % (self.executionpath, dirname, modelname) else: diff --git a/src/m/classes/clusters/frontera.m b/src/m/classes/clusters/frontera.m index 35e372fac..9b1cc3727 100644 --- a/src/m/classes/clusters/frontera.m +++ b/src/m/classes/clusters/frontera.m @@ -174,13 +174,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/gemini.m b/src/m/classes/clusters/gemini.m index aad028b91..fd8aa7972 100644 --- a/src/m/classes/clusters/gemini.m +++ b/src/m/classes/clusters/gemini.m @@ -82,13 +82,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/generic.m b/src/m/classes/clusters/generic.m index 3b08deeef..fcb04c83d 100644 --- a/src/m/classes/clusters/generic.m +++ b/src/m/classes/clusters/generic.m @@ -294,7 +294,7 @@ function BuildKrigingQueueScript(cluster,modelname,solution,io_gather,isvalgrind %}}} function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ - if ~ispc, + if ~ispc %compress the files into one zip. compressstring=['tar -zcf ' dirname '.tar.gz ']; @@ -309,7 +309,6 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - if cluster.verbose, disp('uploading input file and queuing script'); end issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end end %}}} @@ -323,8 +322,6 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ shellext='csh'; end - if cluster.verbose, disp('launching solution sequence on remote cluster'); end - if ~isempty(restart) launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && cd ' dirname ' && source ' modelname '.queue ']; else @@ -344,7 +341,7 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ end %}}} function LaunchQueueJobIceOcean(cluster,modelname,dirname,filelist,restart,batch) % {{{ - if ~ispc, + if ~ispc %figure out what shell extension we will use: if isempty(strfind(cluster.shell,'csh')), @@ -353,8 +350,6 @@ function LaunchQueueJobIceOcean(cluster,modelname,dirname,filelist,restart,batch shellext='csh'; end - if cluster.verbose, disp('launching solution sequence on remote cluster'); end - if ~isempty(restart) launchcommand=['source ' cluster.etcpath '/environment.' shellext ' && cd ' cluster.executionpath ' && cd ' dirname ' && source ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/generic.py b/src/m/classes/clusters/generic.py index f8a16c3a3..eb0a1a730 100644 --- a/src/m/classes/clusters/generic.py +++ b/src/m/classes/clusters/generic.py @@ -200,13 +200,11 @@ def UploadQueueJob(self, modelname, dirname, filelist): # {{{ compressstring += ' {}.errlog {}.outlog '.format(modelname, modelname) call(compressstring, shell=True) - if self.verbose: print('uploading input file and queuing script') issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz']) # }}} def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ - if self.verbose: print('launching solution sequence on remote cluster') if not isempty(restart): launchcommand = 'cd {} && cd {} chmod 755 {}.queue && ./{}.queue'.format(self.executionpath, dirname, modelname, modelname) else: diff --git a/src/m/classes/clusters/generic_static.m b/src/m/classes/clusters/generic_static.m index af9ee2eeb..56b1f908c 100755 --- a/src/m/classes/clusters/generic_static.m +++ b/src/m/classes/clusters/generic_static.m @@ -121,7 +121,6 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ shellext='csh'; end - disp('launching solution sequence'); launchcommand=['source ' modelname '.queue ']; issmssh(cluster.name,'',0,launchcommand); else diff --git a/src/m/classes/clusters/generic_static.py b/src/m/classes/clusters/generic_static.py index 6d6b11d1e..a7897f446 100755 --- a/src/m/classes/clusters/generic_static.py +++ b/src/m/classes/clusters/generic_static.py @@ -82,7 +82,7 @@ def BuildQueueScript(self, dirname, modelname, solution, io_gather, isvalgrind, raise RuntimeError('File ' + self.codepath + '/' + executable + ' does not exist') # Process codepath and prepend empty spaces with \ to avoid errors in queuing script - codepath = self.codepath.replace(' ', '\ ') + codepath = self.codepath.replace(' ', r'\ ') # Write queuing script fid = open(modelname + '.queue', 'w') @@ -117,7 +117,7 @@ def BuildKrigingQueueScript(self, modelname, solution, io_gather, isvalgrind, is raise RuntimeError('File ' + self.codepath + '/' + executable + ' does not exist') # Process codepath and prepend empty spaces with \ to avoid errors in queuing script - codepath = self.codepath.replace(' ', '\ ') + codepath = self.codepath.replace(' ', r'\ ') # Write queuing script fid = open(modelname + '.queue', 'w') @@ -148,7 +148,6 @@ def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ else: shellext='csh' - print('launching solution sequence') launchcommand = './' + modelname + '.queue' subprocess.call([launchcommand]) else: diff --git a/src/m/classes/clusters/greenplanet.m b/src/m/classes/clusters/greenplanet.m index 000cb92ec..2a418f2ba 100644 --- a/src/m/classes/clusters/greenplanet.m +++ b/src/m/classes/clusters/greenplanet.m @@ -151,13 +151,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/hpc.m b/src/m/classes/clusters/hpc.m index 479302236..ca5d318c2 100644 --- a/src/m/classes/clusters/hpc.m +++ b/src/m/classes/clusters/hpc.m @@ -139,13 +139,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/hpc_simba.m b/src/m/classes/clusters/hpc_simba.m index 8f5cd1d30..46a676083 100644 --- a/src/m/classes/clusters/hpc_simba.m +++ b/src/m/classes/clusters/hpc_simba.m @@ -151,13 +151,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/hpc_simba2.m b/src/m/classes/clusters/hpc_simba2.m index 09eeacd3e..145f4b1bc 100755 --- a/src/m/classes/clusters/hpc_simba2.m +++ b/src/m/classes/clusters/hpc_simba2.m @@ -219,7 +219,6 @@ function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{ end end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{ - disp('launching solution sequence on remote cluster: simba20'); if ~isempty(restart) if cluster.isqsub launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && qsub ' modelname '.queue ']; diff --git a/src/m/classes/clusters/localpfe.m b/src/m/classes/clusters/localpfe.m index cf79d7000..cb62136a3 100644 --- a/src/m/classes/clusters/localpfe.m +++ b/src/m/classes/clusters/localpfe.m @@ -243,7 +243,6 @@ function UploadQueueJob(cluster,modelname,dirname,filelist)% {{{ end system(compressstring); - if cluster.verbose, disp('uploading input file and queuing script'); end issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end end %}}} @@ -256,7 +255,7 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch)% {{{ shellext='csh'; end - if cluster.verbose, disp('launching solution sequence on remote cluster'); end + if cluster.verbose, %Execute Queue job end launchcommand=['cd ' cluster.executionpath ' && rm -rf *.lock && rm -rf ADOLC* && tar -zxf ' dirname '.tar.gz && rm -rf *.tar.gz']; issmssh(cluster.name,cluster.login,cluster.port,launchcommand); @@ -271,7 +270,7 @@ function LaunchQueueJobIceOcean(cluster,modelname,dirname,filelist,restart,batch shellext='csh'; end - if cluster.verbose, disp('launching solution sequence on remote cluster'); end + if cluster.verbose, %Execute Queue job end launchcommand=['cd ' cluster.executionpath ' && rm -rf *.lock && tar -zxf ' dirname '.tar.gz && rm -rf *.tar.gz']; issmssh(cluster.name,cluster.login,cluster.port,launchcommand); diff --git a/src/m/classes/clusters/lonestar.m b/src/m/classes/clusters/lonestar.m index 3be30abd2..0bba3edbd 100644 --- a/src/m/classes/clusters/lonestar.m +++ b/src/m/classes/clusters/lonestar.m @@ -175,13 +175,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/maui.m b/src/m/classes/clusters/maui.m index b4d891477..97a557bc0 100644 --- a/src/m/classes/clusters/maui.m +++ b/src/m/classes/clusters/maui.m @@ -126,13 +126,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/pace.m b/src/m/classes/clusters/pace.m index 103b6dd11..73fd52046 100644 --- a/src/m/classes/clusters/pace.m +++ b/src/m/classes/clusters/pace.m @@ -91,13 +91,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/pfe.m b/src/m/classes/clusters/pfe.m index b77b2c846..51ccc7a33 100644 --- a/src/m/classes/clusters/pfe.m +++ b/src/m/classes/clusters/pfe.m @@ -449,7 +449,7 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ end end - disp('launching solution sequence on remote cluster'); + %Execute Queue job issmssh(cluster.name,cluster.login,cluster.port,launchcommand); end %}}} diff --git a/src/m/classes/clusters/pfe.py b/src/m/classes/clusters/pfe.py index 5220376da..8be8edca5 100644 --- a/src/m/classes/clusters/pfe.py +++ b/src/m/classes/clusters/pfe.py @@ -215,7 +215,7 @@ def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ else: launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz && qsub {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname) - print('launching solution sequence on remote cluster') + #Execute Queue job issmssh(self.name, self.login, self.port, launchcommand) # }}} diff --git a/src/m/classes/clusters/pollux.m b/src/m/classes/clusters/pollux.m index 04d753cbd..ed9bbf6a1 100644 --- a/src/m/classes/clusters/pollux.m +++ b/src/m/classes/clusters/pollux.m @@ -71,7 +71,7 @@ function BuildQueueScript(cluster,dirname,modelname,solution,io_gather,isvalgrin %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && qsub ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/saga.py b/src/m/classes/clusters/saga.py index 9aeaffcff..fd0b8ab8d 100644 --- a/src/m/classes/clusters/saga.py +++ b/src/m/classes/clusters/saga.py @@ -152,12 +152,12 @@ def UploadQueueJob(self, modelname, dirname, filelist): # {{{ compressstring += ' {}'.format(file) subprocess.call(compressstring, shell=True) - print('uploading input file and queuing script') + #upload input files issmscpout(self.name, self.executionpath, self.login, self.port, [dirname + '.tar.gz']) # }}} def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ - print('launching solution sequence on remote cluster') + #Execute Queue job if not isempty(restart): launchcommand = 'cd %s && cd %s && sbatch %s.queue' % (self.executionpath, dirname, modelname) else: diff --git a/src/m/classes/clusters/sherlock.m b/src/m/classes/clusters/sherlock.m index 2dba41a5e..df87f457b 100644 --- a/src/m/classes/clusters/sherlock.m +++ b/src/m/classes/clusters/sherlock.m @@ -134,13 +134,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/stanage.m b/src/m/classes/clusters/stanage.m index 4cf10ce5f..21abdf72b 100644 --- a/src/m/classes/clusters/stanage.m +++ b/src/m/classes/clusters/stanage.m @@ -150,13 +150,13 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files issmscpout(cluster.name,cluster.executionpath,cluster.login,0,{[dirname '.tar.gz']}); end %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job if ~isempty(restart) launchcommand=['cd ' cluster.executionpath ' && cd ' dirname ' && hostname && sbatch ' modelname '.queue ']; else diff --git a/src/m/classes/clusters/tetralith.m b/src/m/classes/clusters/tetralith.m old mode 100755 new mode 100644 index 07fe271bf..32dbdb675 --- a/src/m/classes/clusters/tetralith.m +++ b/src/m/classes/clusters/tetralith.m @@ -191,7 +191,7 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ compressstring = [compressstring ' ' filelist{i}]; end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files directory=cluster.executionpath; % issmbbftpout(cluster.name,directory,cluster.login,cluster.port,cluster.numstreams,{[dirname '.tar.gz']}); issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']}); @@ -200,7 +200,7 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ %}}} function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ - disp('launching solution sequence on remote cluster'); + %Execute Queue job launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && hostname && sbatch ' modelname '.queue ']; diff --git a/src/m/classes/clusters/ub_ccr.py b/src/m/classes/clusters/ub_ccr.py index 1669aa77c..0692f0c5c 100644 --- a/src/m/classes/clusters/ub_ccr.py +++ b/src/m/classes/clusters/ub_ccr.py @@ -213,7 +213,7 @@ def UploadQueueJob(self, modelname, dirname, filelist): # {{{ compressstring += ' {}.run {}.errlog {}.outlog'.format(modelname, modelname, modelname) subprocess.call(compressstring, shell=True) - print('uploading input file and queuing script') + #upload input files if self.interactive: directory = '{}/Interactive{}'.format(self.executionpath, self.interactive) else: @@ -243,7 +243,7 @@ def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ else: launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz && sbatch {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname) - print('launching solution sequence on remote cluster') + #Execute Queue job # NOTE: Replacement for issmssh(self.name, self.login, self.port, launchcommand) subprocess.call(launchcommand, shell=True) # }}} diff --git a/src/m/classes/clusters/ub_ccr_from_ghub.py b/src/m/classes/clusters/ub_ccr_from_ghub.py index b77ebe13b..c002477ca 100644 --- a/src/m/classes/clusters/ub_ccr_from_ghub.py +++ b/src/m/classes/clusters/ub_ccr_from_ghub.py @@ -157,7 +157,7 @@ def UploadQueueJob(self, modelname, dirname, filelist): # {{{ compressstring += ' {}.run {}.errlog {}.outlog'.format(modelname, modelname, modelname) subprocess.call(compressstring, shell=True) - print('uploading input file and queuing script') + #upload input files directory = issmexecdir issmscpout(self.name, directory, self.login, self.port, ['{}.tar.gz'.format(dirname)]) @@ -166,7 +166,7 @@ def UploadQueueJob(self, modelname, dirname, filelist): # {{{ def LaunchQueueJob(self, modelname, dirname, filelist, restart, batch): # {{{ launchcommand = 'cd {} && rm -rf ./{} && mkdir {} && cd {} && mv ../{}.tar.gz ./ && tar -zxf {}.tar.gz && sbatch {}.queue'.format(self.executionpath, dirname, dirname, dirname, dirname, dirname, modelname) - print('launching solution sequence on remote cluster') + #Execute Queue job issmssh(self.name, self.login, self.port, launchcommand) # }}} diff --git a/src/m/classes/clusters/yellowstone.m b/src/m/classes/clusters/yellowstone.m old mode 100755 new mode 100644 index 6ac5f3d34..2ded6948a --- a/src/m/classes/clusters/yellowstone.m +++ b/src/m/classes/clusters/yellowstone.m @@ -127,7 +127,7 @@ function UploadQueueJob(cluster,modelname,dirname,filelist) % {{{ end system(compressstring); - disp('uploading input file and queuing script'); + %upload input files directory=cluster.executionpath; issmscpout(cluster.name,directory,cluster.login,cluster.port,{[dirname '.tar.gz']}); @@ -140,7 +140,7 @@ function LaunchQueueJob(cluster,modelname,dirname,filelist,restart,batch) % {{{ launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' dirname ' && mkdir ' dirname ... ' && cd ' dirname ' && mv ../' dirname '.tar.gz ./ && tar -zxf ' dirname '.tar.gz && bsub < ' modelname '.queue ']; - disp('launching solution sequence on remote cluster'); + %Execute Queue job issmssh(cluster.name,cluster.login,cluster.port,launchcommand); end %}}} diff --git a/src/m/classes/hydrologyshakti.m b/src/m/classes/hydrologyshakti.m index efa663cdc..ddbffe201 100644 --- a/src/m/classes/hydrologyshakti.m +++ b/src/m/classes/hydrologyshakti.m @@ -73,7 +73,7 @@ md = checkfield(md,'fieldname','hydrology.neumannflux','timeseries',1,'NaN',1,'Inf',1); md = checkfield(md,'fieldname','hydrology.spchead','Inf',1,'timeseries',1); md = checkfield(md,'fieldname','hydrology.relaxation','>=',0); - md = checkfield(md,'fieldname','hydrology.storage','>=',0,'universal',1,'NaN',1,'Inf',1); + md = checkfield(md,'fieldname','hydrology.storage','>=',0,'size','universal','NaN',1,'Inf',1); md = checkfield(md,'fieldname','hydrology.requested_outputs','stringrow',1); end % }}} function disp(self) % {{{ diff --git a/src/m/classes/hydrologyshakti.py b/src/m/classes/hydrologyshakti.py index 4e2a9b46d..4a0629f43 100644 --- a/src/m/classes/hydrologyshakti.py +++ b/src/m/classes/hydrologyshakti.py @@ -86,7 +86,7 @@ def checkconsistency(self, md, solution, analyses): # {{{ md = checkfield(md, 'fieldname', 'hydrology.neumannflux', 'timeseries', 1, 'NaN', 1, 'Inf', 1) md = checkfield(md, 'fieldname', 'hydrology.spchead', 'Inf', 1, 'timeseries', 1) md = checkfield(md, 'fieldname', 'hydrology.relaxation', '>=', 0) - md = checkfield(md, 'fieldname', 'hydrology.storage', '>=', 0, 'universal', 1, 'NaN', 1, 'Inf', 1) + md = checkfield(md, 'fieldname', 'hydrology.storage', '>=', 0, 'size', 'universal', 'NaN', 1, 'Inf', 1) md = checkfield(md, 'fieldname', 'hydrology.requested_outputs', 'stringrow', 1) return md # }}} diff --git a/src/m/classes/independent.m b/src/m/classes/independent.m index 1860582ec..4e2afc5f1 100644 --- a/src/m/classes/independent.m +++ b/src/m/classes/independent.m @@ -5,15 +5,15 @@ classdef independent properties (SetAccess=public) - name = ''; - type = ''; - fos_forward_index = NaN; - fov_forward_indices = []; - nods = 0; - min_parameters = NaN; - max_parameters = NaN; - control_scaling_factor = NaN; - control_size = 0; + name = ''; + type = ''; + fos_forward_index = NaN; + fov_forward_indices = []; + nods = 0; + min_parameters = NaN; + max_parameters = NaN; + control_scaling_factor = 0; + control_size = 0; end methods @@ -23,7 +23,8 @@ options=pairoptions(varargin{:}); %OK get other fields - self=AssignObjectFields(pairoptions(varargin{:}),self); + self = setdefaultparameters(self); + self = AssignObjectFields(pairoptions(varargin{:}), self); if(self.control_size == 0) self.control_size = 1; @@ -33,11 +34,13 @@ end %}}} function self = setdefaultparameters(self) % {{{ - %do nothing + + %Set default scaling factor to 1 (i.e., do not scale) + self.control_scaling_factor = 1.0; end % }}} function md = checkconsistency(self,md,i,solution,analyses,driver) % {{{ - if ~isnan(self.fos_forward_index), + if ~isnan(self.fos_forward_index) if ~strcmpi(driver,'fos_forward'), error('cannot declare an independent with a fos_forward_index when the driver is not fos_forward!'); end @@ -46,7 +49,7 @@ end end - if ~isempty(self.fov_forward_indices), + if ~isempty(self.fov_forward_indices) if ~strcmpi(driver,'fov_forward'), error('cannot declare an independent with fov_forward_indices when the driver is not fov_forward!'); end @@ -54,11 +57,11 @@ error('independent checkconsistency error: nods should be set to the size of the independent variable'); end md = checkfield(md,'fieldname',['autodiff.independents{' num2str(i) '}.fov_forward_indices'],'>=',1,'<=',self.nods,'size',[NaN 1]); - %md = checkfield(md,'fieldname',['autodiff.independents{' num2str(i) '}.min_parameters'],'size',[md.mesh.numberofvertices 1]); - %md = checkfield(md,'fieldname',['autodiff.independents{' num2str(i) '}.max_parameters'],'size',[md.mesh.numberofvertices 1]); - %md = checkfield(md,'fieldname',['autodiff.independents{' num2str(i) '}.control_scaling_factors'],'size',[1 1],'>',0,'NaN',1,'Inf',1); - end + + %md = checkfield(md,'fieldname',['autodiff.independents{' num2str(i) '}.min_parameters'],'size',[md.mesh.numberofvertices 1]); + %md = checkfield(md,'fieldname',['autodiff.independents{' num2str(i) '}.max_parameters'],'size',[md.mesh.numberofvertices 1]); + md = checkfield(md,'fieldname',['autodiff.independents{' num2str(i) '}.control_scaling_factor'],'size',[1 1],'>',0,'NaN',1,'Inf',1); end % }}} function disp(self) % {{{ disp(sprintf(' independent variable:')); diff --git a/src/m/classes/independent.py b/src/m/classes/independent.py index 5d79b88cc..69efdbef2 100644 --- a/src/m/classes/independent.py +++ b/src/m/classes/independent.py @@ -20,16 +20,14 @@ def __init__(self, *args): # {{{ self.nods = 0 self.min_parameters = np.nan self.max_parameters = np.nan - self.control_scaling_factor = np.nan + self.control_scaling_factor = 0.0 self.control_size = 0 - # Set defaults - self.setdefaultparameters() - # Use provided options to change fields options = pairoptions(*args) # Get other fields + self.setdefaultparameters() self = options.AssignObjectFields(self) if self.control_size == 0: @@ -55,7 +53,10 @@ def __repr__(self): # {{{ # }}} def setdefaultparameters(self): # {{{ - # Do nothing + + # Set default scaling factor to 1 (i.e., do not scale) + self.control_scaling_factor = 1.0 + return self # }}} @@ -73,5 +74,7 @@ def checkconsistency(self, md, i, solution, analyses, driver): # {{{ raise TypeError('independent checkconsistency error: nods should be set to the size of the independent variable') md = checkfield(md, 'fieldname', 'autodiff.independents[%d].fov_forward_indices' % i, '>=', 1, '<=', self.nods) + md = checkfield(md, 'fieldname', 'autodiff.independents[%d].control_scaling_factor' % i, 'size', [1, 1], '>', 0., 'NaN', 1, 'Inf', 1) + return md # }}} diff --git a/src/m/classes/materials.py b/src/m/classes/materials.py index 0cee60d14..bee8c27f1 100644 --- a/src/m/classes/materials.py +++ b/src/m/classes/materials.py @@ -252,8 +252,6 @@ def checkconsistency(self, md, solution, analyses): # {{{ if md.materials.issolid[0] == 0 or md.materials.lame_mu[0] == 0: raise RuntimeError('First layer must be solid (issolid[0] > 0 AND lame_mu[0] > 0). Add a weak inner core if necessary.') ind = np.where(md.materials.issolid == 0)[0] - #if np.sum(np.in1d(np.diff(ind),1) >= 1): # If there are at least two consecutive indices that contain issolid = 0 - # raise RuntimeError('Fluid layers detected at layers #' + indices + ', but having 2 or more adjacent fluid layers is not supported yet. Consider merging them.') elif nat == 'hydro': md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0) diff --git a/src/m/classes/matice.js b/src/m/classes/matice.js index 4dceb2997..ebb9adbc6 100644 --- a/src/m/classes/matice.js +++ b/src/m/classes/matice.js @@ -97,8 +97,8 @@ function matice(){ checkfield(md,'fieldname','materials.rho_water','>',0); checkfield(md,'fieldname','materials.rho_freshwater','>',0); checkfield(md,'fieldname','materials.mu_water','>',0); - checkfield(md,'fieldname','materials.rheology_B','>',0,'universal',1,'NaN',1,'Inf',1); - checkfield(md,'fieldname','materials.rheology_n','>',0,'universal',1,'NaN',1,'Inf',1); + checkfield(md,'fieldname','materials.rheology_B','>',0,'size','universal','NaN',1,'Inf',1); + checkfield(md,'fieldname','materials.rheology_n','>',0,'size','universal','NaN',1,'Inf',1); checkfield(md,'fieldname','materials.rheology_law','values',['None','BuddJacka','Cuffey','CuffeyTemperate','Paterson','Arrhenius','LliboutryDuval','NyeH2O','NyeCO2']); checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0,1,2]) } diff --git a/src/m/classes/matice.m b/src/m/classes/matice.m index 9d519547d..ff1cd8912 100644 --- a/src/m/classes/matice.m +++ b/src/m/classes/matice.m @@ -111,8 +111,8 @@ md = checkfield(md,'fieldname','materials.rho_water','>',0); md = checkfield(md,'fieldname','materials.rho_freshwater','>',0); md = checkfield(md,'fieldname','materials.mu_water','>',0); - md = checkfield(md,'fieldname','materials.rheology_B','>',0,'universal',1,'NaN',1,'Inf',1); - md = checkfield(md,'fieldname','materials.rheology_n','>',0,'universal',1,'NaN',1,'Inf',1); + md = checkfield(md,'fieldname','materials.rheology_B','>',0,'size','universal','NaN',1,'Inf',1); + md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size','universal','NaN',1,'Inf',1); md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'BuddJacka' 'Cuffey' 'CuffeyTemperate' 'Paterson' 'Arrhenius' 'LliboutryDuval' 'NyeCO2' 'NyeH2O'}); md = checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0 1 2]); end diff --git a/src/m/classes/matice.py b/src/m/classes/matice.py index f513ad1a2..125d4c248 100644 --- a/src/m/classes/matice.py +++ b/src/m/classes/matice.py @@ -112,8 +112,8 @@ def checkconsistency(self, md, solution, analyses): # {{{ md = checkfield(md, 'fieldname', 'materials.rho_water', '>', 0) md = checkfield(md, 'fieldname', 'materials.rho_freshwater', '>', 0) md = checkfield(md, 'fieldname', 'materials.mu_water', '>', 0) - md = checkfield(md, 'fieldname', 'materials.rheology_B', '>', 0, 'universal', 1, 'NaN', 1, 'Inf', 1) - md = checkfield(md, 'fieldname', 'materials.rheology_n', '>', 0, 'universal',1, 'NaN', 1, 'Inf', 1) + md = checkfield(md, 'fieldname', 'materials.rheology_B', '>', 0, 'size', 'universal', 'NaN', 1, 'Inf', 1) + md = checkfield(md, 'fieldname', 'materials.rheology_n', '>', 0, 'size', 'universal', 'NaN', 1, 'Inf', 1) md = checkfield(md, 'fieldname', 'materials.rheology_law', 'values', ['None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', 'NyeH2O']) md = checkfield(md, 'fieldname', 'materials.effectiveconductivity_averaging', 'numel', [1], 'values', [0, 1, 2]) diff --git a/src/m/classes/mesh3dsurface.py b/src/m/classes/mesh3dsurface.py index e7aa3de1f..25a2024cb 100644 --- a/src/m/classes/mesh3dsurface.py +++ b/src/m/classes/mesh3dsurface.py @@ -103,7 +103,11 @@ def checkconsistency(self, md, solution, analyses): # {{{ md = checkfield(md, 'fieldname', 'mesh.r', 'NaN', 1, 'Inf', 1, 'size', [md.mesh.numberofvertices]) md = checkfield(md, 'fieldname', 'mesh.elements', 'NaN', 1, 'Inf', 1, '>', 0, 'values', np.arange(1, md.mesh.numberofvertices + 1)) md = checkfield(md, 'fieldname', 'mesh.elements', 'size', [md.mesh.numberofelements, 3]) - if np.any(np.logical_not(np.in1d(np.arange(1, md.mesh.numberofvertices + 1), md.mesh.elements.flat))): + if hasattr(np, 'isin'): #Numpy 2017+ + tmp = np.isin(np.arange(1, md.mesh.numberofvertices + 1), md.mesh.elements.flat) + else: #For backward compatibility + tmp = np.in1d(np.arange(1, md.mesh.numberofvertices + 1), md.mesh.elements.flat) + if np.any(np.logical_not(tmp)): md = md.checkmessage('orphan nodes have been found; check the mesh outline') md = checkfield(md, 'fieldname', 'mesh.numberofelements', '>', 0) diff --git a/src/m/classes/mismipbasalforcings.m b/src/m/classes/mismipbasalforcings.m index ff81eb9a4..657d42341 100644 --- a/src/m/classes/mismipbasalforcings.m +++ b/src/m/classes/mismipbasalforcings.m @@ -46,19 +46,19 @@ if ismember('MasstransportAnalysis',analyses) & ~(strcmp(solution,'TransientSolution') & md.transient.ismasstransport==0), md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1); - md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'universal',1,'NaN',1,'Inf',1); + md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'size','universal','NaN',1,'Inf',1); md = checkfield(md,'fieldname','basalforcings.threshold_thickness','>=',0,'numel',1); md = checkfield(md,'fieldname','basalforcings.upperdepth_melt','<=',0,'numel',1); end if ismember('BalancethicknessAnalysis',analyses), md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'size',[md.mesh.numberofvertices 1]); - md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'universal',1,'NaN',1,'Inf',1); + md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'size','universal','NaN',1,'Inf',1); md = checkfield(md,'fieldname','basalforcings.threshold_thickness','>=',0,'numel',1); md = checkfield(md,'fieldname','basalforcings.upperdepth_melt','<=',0,'numel',1); end if ismember('ThermalAnalysis',analyses) & ~(strcmp(solution,'TransientSolution') & md.transient.isthermal==0), md = checkfield(md,'fieldname','basalforcings.groundedice_melting_rate','NaN',1,'Inf',1,'timeseries',1); - md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'universal',1,'NaN',1,'Inf',1); + md = checkfield(md,'fieldname','basalforcings.meltrate_factor','>=',0,'size','universal','NaN',1,'Inf',1); md = checkfield(md,'fieldname','basalforcings.threshold_thickness','>=',0,'numel',1); md = checkfield(md,'fieldname','basalforcings.upperdepth_melt','<=',0,'numel',1); md = checkfield(md,'fieldname','basalforcings.geothermalflux','NaN',1,'Inf',1,'timeseries',1,'>=',0); diff --git a/src/m/classes/model.m b/src/m/classes/model.m index 62c1f630b..1586acabc 100644 --- a/src/m/classes/model.m +++ b/src/m/classes/model.m @@ -598,7 +598,7 @@ function disp(self) % {{{ %copy model md1=md; - %recover optoins: + %recover options: options=pairoptions(varargin{:}); %some checks @@ -662,13 +662,13 @@ function disp(self) % {{{ %loop over model fields model_fields=fields(md1); - for i=1:length(model_fields), + for i=1:length(model_fields) %get field field=md1.(model_fields{i}); fieldsize=size(field); if isobject(field), %recursive call object_fields=fields(md1.(model_fields{i})); - for j=1:length(object_fields), + for j=1:length(object_fields) %get field field=md1.(model_fields{i}).(object_fields{j}); fieldsize=size(field); @@ -677,7 +677,7 @@ function disp(self) % {{{ md2.(model_fields{i}).(object_fields{j})=field(pos_node,:); elseif (fieldsize(1)==numberofvertices1+1) md2.(model_fields{i}).(object_fields{j})=[field(pos_node,:); field(end,:)]; - %size = number of elements * n + %size = number of elements * n elseif fieldsize(1)==numberofelements1 md2.(model_fields{i}).(object_fields{j})=field(pos_elem,:); elseif (fieldsize(1)==numberofelements1+1) @@ -690,7 +690,7 @@ function disp(self) % {{{ md2.(model_fields{i})=field(pos_node,:); elseif (fieldsize(1)==numberofvertices1+1) md2.(model_fields{i})=[field(pos_node,:); field(end,:)]; - %size = number of elements * n + %size = number of elements * n elseif fieldsize(1)==numberofelements1 md2.(model_fields{i})=field(pos_elem,:); elseif (fieldsize(1)==numberofelements1+1) @@ -706,6 +706,13 @@ function disp(self) % {{{ md2.mesh.numberofvertices=numberofvertices2; md2.mesh.elements=elements_2; + % Extract ISMIP6 basal tf field + if isa(md1.basalforcings, 'basalforcingsismip6') + for i=1:numel(md.basalforcings.tf) + md2.basalforcings.tf{i} = [md1.basalforcings.tf{i}(pos_node); md1.basalforcings.tf{i}(end)]; + end + end + %mesh.uppervertex mesh.lowervertex if isa(md1.mesh,'mesh3dprisms'), md2.mesh.uppervertex=md1.mesh.uppervertex(pos_node); diff --git a/src/m/classes/modellist.m b/src/m/classes/modellist.m index cd1f72aa1..78ec9cb41 100644 --- a/src/m/classes/modellist.m +++ b/src/m/classes/modellist.m @@ -378,7 +378,7 @@ function LaunchMultipleQueueJob(cluster,name,executionpath)% {{{ %upload both files to cluster disp('uploading input file, queuing script and variables script'); -eval(['!scp ModelList.tar.gz ' name '.queue ' cluster ':' executionpath]); +system(['scp ModelList.tar.gz ' name '.queue ' cluster ':' executionpath]); disp('launching solution sequence on remote cluster'); issmssh(cluster,login,['"cd ' executionpath ' && source ' name '.queue "']); diff --git a/src/m/classes/rifts.py b/src/m/classes/rifts.py index 8847e4073..01a4b86d5 100644 --- a/src/m/classes/rifts.py +++ b/src/m/classes/rifts.py @@ -25,9 +25,8 @@ def __init__(self): # {{{ def __repr__(self): # {{{ string = ' rifts parameters:' - - string = "%s\n%s" % (string, fielddisplay(self, 'riftstruct', 'structure containing all rift information (vertices coordinates, segments, type of melange, ...)')) - string = "%s\n%s" % (string, fielddisplay(self, 'riftproperties', '')) + string += '\n{}'.format(fielddisplay(self, 'riftstruct', 'structure containing all rift information (vertices coordinates, segments, type of melange, ...)')) + string += '\n{}'.format(fielddisplay(self, 'riftproperties', '')) return string # }}} @@ -43,17 +42,17 @@ def checkconsistency(self, md, solution, analyses): # {{{ if numrifts: if not m.strcmp(md.mesh.domaintype(), '2Dhorizontal'): - md.checkmessage("models with rifts are only supported in 2d for now!") + md.checkmessage('models with rifts are only supported in 2d for now!') if not isinstance(self.riftstruct, list): - md.checkmessage("rifts.riftstruct should be a structure!") + md.checkmessage('rifts.riftstruct should be a list of dict!') if np.any(md.mesh.segmentmarkers >= 2): #We have segments with rift markers, but no rift structure! - md.checkmessage("model should be processed for rifts (run meshprocessrifts)!") + md.checkmessage('model should be processed for rifts (run meshprocessrifts)!') for i, rift in enumerate(self.riftstruct): - md = checkfield(md, 'fieldname', "rifts.riftstruct[{}]['fill']".format(i), 'values', ['Water', 'Air', 'Ice', 'Melange', 0, 1, 2, 3]) + md = checkfield(md, 'fieldname', 'rifts.riftstruct[{}][\'fill\']'.format(i), 'values', ['Water', 'Air', 'Ice', 'Melange', 0, 1, 2, 3]) else: if self.riftstruct and np.any(np.logical_not(isnans(self.riftstruct))): - md.checkmessage("riftstruct should be NaN since numrifts is 0!") + md.checkmessage('riftstruct should be NaN since numrifts is 0!') return md # }}} diff --git a/src/m/classes/sampling.py b/src/m/classes/sampling.py index 4f84284d4..c0cf199ed 100644 --- a/src/m/classes/sampling.py +++ b/src/m/classes/sampling.py @@ -1,6 +1,6 @@ import numpy as np -from math import * +import math from checkfield import checkfield from fielddisplay import fielddisplay @@ -38,7 +38,7 @@ def __repr__(self): # {{{ s += '{}\n'.format(fielddisplay(self, 'tau', 'scaling coefficient of the solution (default: 1.0)')) s += '{}\n'.format(fielddisplay(self, 'alpha', 'exponent in PDE operator, (default: 2.0, BiLaplacian covariance operator)')) - s += ' Parameters of Robin boundary conditions nabla () \cdot normvec + beta ():\n' + s += ' Parameters of Robin boundary conditions nabla () \\cdot normvec + beta ():\n' s += '{}\n'.format(fielddisplay(self, 'robin', 'Apply Robin boundary conditions (1 if applied and 0 for homogenous Neumann boundary conditions) (default: 0)')) s += '{}\n'.format(fielddisplay(self, 'beta', 'Coefficient in Robin boundary conditions (to be defined for robin = 1)')) diff --git a/src/m/classes/sealevelmodel.m b/src/m/classes/sealevelmodel.m index 94121ca6c..e8df67f73 100644 --- a/src/m/classes/sealevelmodel.m +++ b/src/m/classes/sealevelmodel.m @@ -58,54 +58,57 @@ function checkconsistency(slm,solutiontype) % {{{ %end %check that the transition vectors have the right size: - if slm.earth.mesh.numberofvertices ~= length(slm.earth.solidearth.transfercount) - error('sealevelmodel.m::checkconsistency: earth.solidearth.transfercount should be of size earth.mesh.numberofvertices') + error('earth.solidearth.transfercount should be of size earth.mesh.numberofvertices') end - %check that the transition vectors have the right size: - for i=1:length(slm.icecaps), - if slm.icecaps{i}.mesh.numberofvertices ~= length(slm.earth.solidearth.transitions{i}), - error(['sealevelmodel.m::checkconsistency: issue with size of transition vector for ice cap: ' num2str(i) ' name: ' slm.icecaps{i}.miscellaneous.name]); - end - end - - %check that runfrequency is the same everywhere: - for i=1:length(slm.icecaps), - if slm.icecaps{i}.solidearth.settings.runfrequency~=slm.earth.solidearth.settings.runfrequency, - error(sprintf('sealevelmodel.m::checkconsistency: icecap model %s should have the same run frequency as earth!',slm.icecaps{i}.miscellaneous.name)); - end + %check that slc is on + if slm.earth.transient.isslc ==0 + error('earth.transient.isslc should be turned on') end - %make sure steric_rate is the same everywhere: for i=1:length(slm.icecaps), + md= slm.icecaps{i}; - if ~isempty(find(md.dsl.sea_surface_height_above_geoid - slm.earth.dsl.sea_surface_height_above_geoid(slm.transitions{i}))), - error(sprintf('sealevelmodel.m::checkconsistency: steric rate on ice cap %s is not the same as for the earth\n',md.miscellaneous.name)); + + %check that the transition vectors have the right size: + if md.mesh.numberofvertices ~= length(slm.earth.solidearth.transitions{i}), + error(['issue with size of transition vector for ice cap: ' num2str(i) ' name: ' md.miscellaneous.name]); end - end - %make sure grd is the same everywhere: - for i=1:length(slm.icecaps), - md= slm.icecaps{i}; + %check that runfrequency is the same everywhere: + if md.solidearth.settings.runfrequency~=slm.earth.solidearth.settings.runfrequency + error(['icecap model ' md.miscellaneous.name ' should have the same run frequency as earth!']); + end + + %make sure steric_rate is the same everywhere: + if ~isempty(find(md.dsl.sea_surface_height_above_geoid - slm.earth.dsl.sea_surface_height_above_geoid(slm.transitions{i}))) + error(['steric rate on ice cap ' md.miscellaneous.name ' is not the same as for the earth']); + end + + %make sure grd is the same everywhere: if md.solidearth.settings.isgrd~=slm.earth.solidearth.settings.isgrd - error(sprintf('sealevelmodel.m::checkconsistency: isgrd on ice cap %s is not the same as for the earth\n',md.miscellaneous.name)); + error(['isgrd on ice cap ' md.miscellaneous.name ' is not the same as for the earth']); end - end - %make sure that there is no solid earth external forcing on the basins: - for i=1:length(slm.icecaps), - md= slm.icecaps{i}; - if ~isempty(md.solidearth.external), - error('sealevelmodel.m::checkconsistency: cannot run external forcings on an ice sheet when running a coupling earth/ice sheet model'); + %make sure that there is no solid earth external forcing on the basins: + if ~isempty(md.solidearth.external) + error('cannot run external forcings on an ice sheet when running a coupling earth/ice sheet model'); end - end - %make sure that we have the right grd model for computing out sealevel patterns: - for i=1:length(slm.icecaps), - md= slm.icecaps{i}; + %make sure that there is no solid earth external forcing on the basins: + if ~isempty(md.solidearth.external) + error('cannot run external forcings on an ice sheet when running a coupling earth/ice sheet model'); + end + + %make sure that we have the right grd model for computing out sealevel patterns: if md.solidearth.settings.grdmodel~=0 - error(sprintf('sealevelmodel.m::checkconsistency: ice sheets do not run GRD module, specify solidearth.settings.grdmodel=0 on ice cap %i',i)); + error(['ice sheets do not run GRD module, specify solidearth.settings.grdmodel=0 on ice cap ',num2str(i)]); + end + + %make sure sea level change solver is on + if md.transient.isslc==0 + error(['isslc on ice cap ' md.miscellaneous.name ' is not turned off']); end end diff --git a/src/m/consistency/checkfield.m b/src/m/consistency/checkfield.m index 60a4c0271..ffcc6ed1b 100644 --- a/src/m/consistency/checkfield.m +++ b/src/m/consistency/checkfield.m @@ -11,9 +11,9 @@ % - size: [lines cols], NaN for non checked dimensions, or 'universal' for any input type (nodal, element, time series, etc) % - >: greater than provided value % - >=: greater or equal to provided value -% - <: smallerthan provided value +% - <: smaller than provided value % - <=: smaller or equal to provided value -% - < vec: smallerthan provided values on each vertex +% - < vec: smaller than provided values on each vertex % - timeseries: 1 if check time series consistency (size and time) % - values: cell of strings or vector of acceptable values % - numel: list of acceptable number of elements diff --git a/src/m/consistency/checkfield.py b/src/m/consistency/checkfield.py index ec1e808d9..38807f694 100644 --- a/src/m/consistency/checkfield.py +++ b/src/m/consistency/checkfield.py @@ -1,6 +1,6 @@ import numpy as np import os -from re import findall, split +from re import findall, match, split from pairoptions import pairoptions from operator import attrgetter import MatlabFuncs as m @@ -40,23 +40,56 @@ def checkfield(md, *args): options = pairoptions(*args) #get field from model + field = None if options.exist('field'): field = options.getfieldvalue('field') fieldname = options.getfieldvalue('fieldname', 'no fieldname') else: fieldname = options.getfieldvalue('fieldname') - fieldprefix = split(r'\[(.*?)\]', fieldname)[0] - fieldindexes = findall(r'\[(.*?)\]', fieldname) - field = attrgetter(fieldprefix)(md) - for index in fieldindexes: - try: - field = field[index.strip("\'")] - except TypeError: - field = field[int(index)] #looking for an index and not a key - - # that works for py2 - # exec("field = md.{}".format(fieldname)) - # exec("field = md.{}".format(fieldname), namespace) + fieldnametokens = split(r'\.', fieldname) + for i in range(len(fieldnametokens)): + if match(r'(.*?)\[(.*?)\]\[(.*?)\]', fieldnametokens[i]): + # Handle 2D list and list of dict addressing + listname = split(r'\[(.*?)\]', fieldnametokens[i])[0] + listindices = findall(r'\[(.*?)\]', fieldnametokens[i]) + if field == None: + field = attrgetter(listname)(md) + else: + field = attrgetter(listname)(field) + try: + listindex = int(listindices[0]) + field = field[listindex] + try: + listindex = int(listindices[1]) + except: + listindex = listindices[1][1:-1] # Strip enclosing quote + field = field[listindex] + except: + listindex = listindices[0][1:-1] # Strip enclosing quote + field = field[listindex] + try: + listindex = int(listindices[1]) + except: + listindex = listindices[1][1:-1] # Strip enclosing quote + field = field[listindex] + elif match(r'(.*?)\[(.*?)\]', fieldnametokens[i]): + # Handle list and dict addressing + listname = split(r'\[(.*?)\]', fieldnametokens[i])[0] + listindex = findall(r'\[(.*?)\]', fieldnametokens[i])[0] + if field == None: + field = attrgetter(listname)(md) + else: + field = attrgetter(listname)(field) + try: + listindex = int(listindex) + field = field[listindex] + except: + field = attrgetter(listindex)(field) + else: + if field == None: + field = attrgetter(fieldnametokens[i])(md) + else: + field = attrgetter(fieldnametokens[i])(field) if isinstance(field, (bool, int, float)): field = np.array([field]) @@ -64,7 +97,7 @@ def checkfield(md, *args): #check empty if options.exist('empty'): if not field: - md = md.checkmessage(options.getfieldvalue('message', "field '{}' is empty".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' is empty'.format(fieldname))) #Check size if options.exist('size'): @@ -82,12 +115,12 @@ def checkfield(md, *args): #Uniform field if (field.shape[0] == 1): if (np.ndim(field) > 1 and np.shape(field)[1] != 1): - md = md.checkmessage(options.getfieldvalue('message', "field '{}' is not supported".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' is not supported'.format(fieldname))) #vertex oriented input, only one column allowed elif (np.shape(field)[0] == md.mesh.numberofvertices): if (np.ndim(field) > 1 and np.shape(field)[1] != 1): - md = md.checkmessage(options.getfieldvalue('message', "field '{}' is not supported".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' is not supported'.format(fieldname))) #element oriented input, one or more column (patch) is ok elif (np.shape(field)[0] == md.mesh.numberofelements): @@ -97,69 +130,69 @@ def checkfield(md, *args): #vertex time series elif (np.shape(field)[0] == md.mesh.numberofvertices + 1): if (np.ndim(field) > 1 and np.shape(field)[1] <= 1): - md = md.checkmessage(options.getfieldvalue('message', "field '{}' is not supported".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' is not supported'.format(fieldname))) #element time series elif (np.shape(field)[0] == md.mesh.numberofelements + 1): if (np.ndim(field) > 1 and np.shape(field)[1] <= 1): - md = md.checkmessage(options.getfieldvalue('message', "field '{}' is not supported".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' is not supported'.format(fieldname))) #else not supported else: - md = md.checkmessage(options.getfieldvalue('message', "field '{}' is not supported".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' is not supported'.format(fieldname))) else: - raise Exception("fieldsize '{}' not supported yet".format(fieldsize)) + raise Exception('fieldsize \'{}\' not supported yet'.format(fieldsize)) else: if len(np.shape(field)) < len(fieldsize): if fieldsize[-1] > 1: - md = md.checkmessage(options.getfieldvalue('message', "field {} has size {} but should be size {}".format(fieldname, np.shape(field), fieldsize))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} has size {} but should be size {}'.format(fieldname, np.shape(field), fieldsize))) else: - #The last dimension is one that follows matlab 2D array regulation but usually not what we do in python, we allow the difference in shape only if the number of element is equal + #The last dimension is one that follows MATLAB 2D array regulation but usually not what we do in Python, we allow the difference in shape only if the number of element is equal if np.prod(np.shape(field)) != np.prod(fieldsize): - md = md.checkmessage(options.getfieldvalue('message', "field {} has size {} but should be size {}".format(fieldname, np.shape(field), fieldsize))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} has size {} but should be size {}'.format(fieldname, np.shape(field), fieldsize))) else: for i in range(np.size(fieldsize)): if (not np.isnan(fieldsize[i])) and (np.shape(field)[i] != fieldsize[i]): - md = md.checkmessage(options.getfieldvalue('message', "field {} dimension # {} should be of size {}".format(fieldname, i, fieldsize[i]))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} dimension # {} should be of size {}'.format(fieldname, i, fieldsize[i]))) #Check numel if options.exist('numel'): fieldnumel = options.getfieldvalue('numel') if (type(fieldnumel) == int and np.size(field) != fieldnumel) or (type(fieldnumel) == list and np.size(field) not in fieldnumel): if len(fieldnumel) == 1: - md = md.checkmessage(options.getfieldvalue('message', "field '{}' size should be {}".format(fieldname, fieldnumel))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' size should be {}'.format(fieldname, fieldnumel))) elif len(fieldnumel) == 2: - md = md.checkmessage(options.getfieldvalue('message', "field '{}' size should be {} or {}".format(fieldname, fieldnumel[0], fieldnumel[1]))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' size should be {} or {}'.format(fieldname, fieldnumel[0], fieldnumel[1]))) else: - md = md.checkmessage(options.getfieldvalue('message', "field '{}' size should be {}".format(fieldname, fieldnumel))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' size should be {}'.format(fieldname, fieldnumel))) #check NaN if options.getfieldvalue('NaN', 0): if np.any(np.isnan(field)): - md = md.checkmessage(options.getfieldvalue('message', "NaN values found in field '{}'".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'NaN values found in field \'{}\''.format(fieldname))) #check Inf if options.getfieldvalue('Inf', 0): if np.any(np.isinf(field)): - md = md.checkmessage(options.getfieldvalue('message', "Inf values found in field '{}'".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'Inf values found in field \'{}\''.format(fieldname))) #check cell if options.getfieldvalue('cell', 0): if not isinstance(field, (tuple, list, dict)): - md = md.checkmessage(options.getfieldvalue('message', "field '{}' should be a tuple, list, or dict".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' should be a tuple, list, or dict'.format(fieldname))) #check values if options.exist('values'): fieldvalues = options.getfieldvalue('values') if False in m.ismember(field, fieldvalues): if len(fieldvalues) == 1: - md = md.checkmessage(options.getfieldvalue('message', "field '{}' value should be '{}'".format(fieldname, fieldvalues[0]))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' value should be \'{}\''.format(fieldname, fieldvalues[0]))) elif len(fieldvalues) == 2: - md = md.checkmessage(options.getfieldvalue('message', "field '{}' values should be '{}' or '{}'".format(fieldname, fieldvalues[0], fieldvalues[1]))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' values should be \'{}\' or \'{}\''.format(fieldname, fieldvalues[0], fieldvalues[1]))) else: - md = md.checkmessage(options.getfieldvalue('message', "field '{}' should have values in {}".format(fieldname, fieldvalues))) + md = md.checkmessage(options.getfieldvalue('message', 'field \'{}\' should have values in {}'.format(fieldname, fieldvalues))) #check greater if options.exist('>='): @@ -168,7 +201,7 @@ def checkfield(md, *args): lowerbound = attrgetter(lowerbound)(md) if np.size(lowerbound) > 1: #checking elementwise if any(field < lowerbound): - md = md.checkmessage(options.getfieldvalue('message', "field {} should have values above {}".format(fieldname, lowerbound))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have values above {}'.format(fieldname, lowerbound))) else: minval = np.nanmin(field) if options.getfieldvalue('timeseries', 0): @@ -182,7 +215,7 @@ def checkfield(md, *args): minval = np.nanmin(field[:-1]) if minval < lowerbound: - md = md.checkmessage(options.getfieldvalue('message', "field {} should have values above {}".format(fieldname, lowerbound))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have values above {}'.format(fieldname, lowerbound))) if options.exist('>'): lowerbound = options.getfieldvalue('>') @@ -190,7 +223,7 @@ def checkfield(md, *args): lowerbound = attrgetter(lowerbound)(md) if np.size(lowerbound) > 1: #checking elementwise if any(field <= lowerbound): - md = md.checkmessage(options.getfieldvalue('message', "field {} should have values above {}".format(fieldname, lowerbound))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have values above {}'.format(fieldname, lowerbound))) else: minval = np.nanmin(field) if options.getfieldvalue('timeseries', 0): @@ -204,7 +237,7 @@ def checkfield(md, *args): minval = np.nanmin(field[:-1]) if minval <= lowerbound: - md = md.checkmessage(options.getfieldvalue('message', "field {} should have values above {}".format(fieldname, lowerbound))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have values above {}'.format(fieldname, lowerbound))) #check smaller if options.exist('<='): @@ -213,7 +246,7 @@ def checkfield(md, *args): upperbound = attrgetter(upperbound)(md) if np.size(upperbound) > 1: #checking elementwise if any(field > upperbound): - md = md.checkmessage(options.getfieldvalue('message', "field {} should have values below {}".format(fieldname, upperbound))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have values below {}'.format(fieldname, upperbound))) else: maxval = np.nanmax(field) if options.getfieldvalue('timeseries', 0): @@ -228,7 +261,7 @@ def checkfield(md, *args): elif hasattr(field, 'fov_forward_indices'): maxval = field.fov_forward_indices[0] if maxval > upperbound: - md = md.checkmessage(options.getfieldvalue('message', "field {} should have values below {}".format(fieldname, upperbound))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have values below {}'.format(fieldname, upperbound))) if options.exist('<'): upperbound = options.getfieldvalue('<') @@ -236,7 +269,7 @@ def checkfield(md, *args): upperbound = attrgetter(upperbound)(md) if np.size(upperbound) > 1: #checking elementwise if any(field >= upperbound): - md = md.checkmessage(options.getfieldvalue('message', "field {} should have values below {}".format(fieldname, upperbound))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have values below {}'.format(fieldname, upperbound))) else: maxval = np.nanmax(field) @@ -251,49 +284,49 @@ def checkfield(md, *args): maxval = np.nanmax(field[:-1]) if maxval >= upperbound: - md = md.checkmessage(options.getfieldvalue('message', "field {} should have values below {}".format(fieldname, upperbound))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have values below {}'.format(fieldname, upperbound))) #check file if options.getfieldvalue('file', 0): if not os.path.exists(field): - md = md.checkmessage("file provided in {}: {} does not exist".format(fieldname, field)) + md = md.checkmessage('file provided in {}: {} does not exist'.format(fieldname, field)) #Check row of strings if options.exist('stringrow'): if not isinstance(field, list): - md = md.checkmessage(options.getfieldvalue('message', "field {} should be a list".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should be a list'.format(fieldname))) #Check forcings (size and times) if options.getfieldvalue('timeseries', 0): if field.shape[0] == md.mesh.numberofvertices or field.shape[0] == md.mesh.numberofelements: if np.ndim(field) > 1 and not np.size(field, 1) == 1: - md = md.checkmessage(options.getfieldvalue('message', "field {} should have only one column as there are md.mesh.numberofvertices lines".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have only one column as there are md.mesh.numberofvertices lines'.format(fieldname))) elif field.shape[0] == md.mesh.numberofvertices + 1 or field.shape[0] == md.mesh.numberofelements + 1: if np.ndim(field) > 1 and not all(field[-1, :] == np.sort(field[-1, :])): - md = md.checkmessage(options.getfieldvalue('message', "field {} columns should be sorted chronologically".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} columns should be sorted chronologically'.format(fieldname))) if np.ndim(field) > 1 and any(field[-1, 0:-1] == field[-1, 1:]): - md = md.checkmessage(options.getfieldvalue('message', "field {} columns must not contain duplicate timesteps".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} columns must not contain duplicate timesteps'.format(fieldname))) else: - md = md.checkmessage(options.getfieldvalue('message', "field {} should have md.mesh.numberofvertices or md.mesh.numberofvertices + 1 lines".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have md.mesh.numberofvertices or md.mesh.numberofvertices + 1 lines'.format(fieldname))) #Check single value forcings (size and times) if options.getfieldvalue('singletimeseries', 0): if field.shape[0] == 2: if not all(field[-1, :] == np.sort(field[-1, :])): - md = md.checkmessage(options.getfieldvalue('message', "field {} columns should be sorted chronologically".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} columns should be sorted chronologically'.format(fieldname))) if any(field[-1, 0:-1] == field[-1, 1:]): - md = md.checkmessage(options.getfieldvalue('message', "field {} columns must not contain duplicate timesteps".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} columns must not contain duplicate timesteps'.format(fieldname))) elif field.shape[0] == 1: if np.ndim(field) > 1 and not np.size(field, 1) == 1: - md = md.checkmessage(options.getfieldvalue('message', "field {} should be either a scalar or have 2 lines".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should be either a scalar or have 2 lines'.format(fieldname))) else: - md = md.checkmessage(options.getfieldvalue('message', "field {} should have 2 lines or be a scalar".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} should have 2 lines or be a scalar'.format(fieldname))) #Check forcings (size and times) if options.getfieldvalue('mappedtimeseries', 0): if np.ndim(field) > 1 and not all(field[-1, :] == np.sort(field[-1, :])): - md = md.checkmessage(options.getfieldvalue('message', "field {} columns should be sorted chronologically".format(fieldname))) + md = md.checkmessage(options.getfieldvalue('message', 'field {} columns should be sorted chronologically'.format(fieldname))) if np.ndim(field) > 1 and any(field[-1, 0:-1] == field[-1, 1:]): - md = md.checkmessage(options.getfieldvalue('message', "field {} columns must not contain duplicate timesteps".format(fieldname))) - + md = md.checkmessage(options.getfieldvalue('message', 'field {} columns must not contain duplicate timesteps'.format(fieldname))) + return md diff --git a/src/m/consistency/ismodelselfconsistent.m b/src/m/consistency/ismodelselfconsistent.m index a81f3f3b9..0cce9c071 100644 --- a/src/m/consistency/ismodelselfconsistent.m +++ b/src/m/consistency/ismodelselfconsistent.m @@ -1,4 +1,4 @@ -function ismodelselfconsistent(md), +function ismodelselfconsistent(md) %ISMODELSELFCONSISTENT - check that model forms a closed form solvable problem. % % Usage: @@ -13,7 +13,7 @@ function ismodelselfconsistent(md), %Go through a model field, check that it is a class, and call checkconsistency fields=properties('model'); -for i=1:length(fields), +for i=1:length(fields) field=fields{i}; %Some properties do not need to be checked @@ -32,7 +32,7 @@ function ismodelselfconsistent(md), end %error message if mode is not consistent -if md.private.isconsistent==false, +if md.private.isconsistent==false error('Model not consistent, see messages above'); end end @@ -44,7 +44,7 @@ function ismodelselfconsistent(md), % [analyses]=AnalysisConfiguration(solutiontype); if strcmp(solutiontype,'StressbalanceSolution') - analyses={'StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis','AgeAnalysis'}; + analyses={'StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis'}; elseif strcmp(solutiontype,'SteadystateSolution') analyses={'StressbalanceAnalysis','StressbalanceVerticalAnalysis','StressbalanceSIAAnalysis','L2ProjectionBaseAnalysis','ThermalAnalysis','MeltingAnalysis','EnthalpyAnalysis','AgeAnalysis'}; elseif strcmp(solutiontype,'ThermalSolution') diff --git a/src/m/contrib/chenggong/modeldata/interpdH.m b/src/m/contrib/chenggong/modeldata/interpdH.m index 7963ac696..d1192c9c8 100644 --- a/src/m/contrib/chenggong/modeldata/interpdH.m +++ b/src/m/contrib/chenggong/modeldata/interpdH.m @@ -1,5 +1,7 @@ function dH = interpdH(X, Y, time, ncdata) %INTERPDH - interpolate monthly reconstructed dH onto X and Y, within the given time period +% The dataset is from https://doi.org/10.5061/dryad.s4mw6m9dh +% and the corresponding paper is: https://essd.copernicus.org/articles/17/3047/2025/ % % Usage: % dH = interpdH(md.mesh.x, md.mesh.y, [md.timestepping.start_time, md.timestepping.final_time]); @@ -10,12 +12,13 @@ % if nargin < 4 - ncdata = '/totten_1/ModelData/Greenland/DHKhan/dHdt_monthly_1km.nc'; + ncdata = '/totten_1/ModelData/Greenland/DHKhan/Greenland_dhdt_icevol_1kmgrid_DB.nc'; end -x = ncread(ncdata, 'x'); -y = ncread(ncdata, 'y'); -t = ncread(ncdata, 'time'); +x = double(ncread(ncdata, 'x')); +y = double(ncread(ncdata, 'y')); +t = double(ncread(ncdata, 'time')); % 'days since 2003-01-01' +t = date2decyear(datenum('2003-01-01') + t); offset=2; @@ -39,7 +42,7 @@ t = t(idt_min:idt_max); % load dH -data = ncread(ncdata, 'dHdt', [idx_min, idy_min, idt_min], [idx_max-idx_min+1, idy_max-idy_min+1, idt_max-idt_min+1], [1,1,1]); +data = ncread(ncdata, 'dhdt_vol', [idx_min, idy_min, idt_min], [idx_max-idx_min+1, idy_max-idy_min+1, idt_max-idt_min+1], [1,1,1]); % Convert to ice_levelset values dH = zeros(numel(X)+1, numel(t)); diff --git a/src/m/contrib/jkjhew/basalforcingsismip6.py b/src/m/contrib/jkjhew/basalforcingsismip6.py new file mode 100644 index 000000000..54c7f5c58 --- /dev/null +++ b/src/m/contrib/jkjhew/basalforcingsismip6.py @@ -0,0 +1,291 @@ +import numpy as np + +# ISSM helper imports (same APIs as MATLAB equivalents) +from project3d import project3d +from checkfield import checkfield +from fielddisplay import fielddisplay +from WriteData import WriteData + + +class basalforcingsismip6: + """ + Python port of ISSM's basalforcingsismip6 class. + + Usage: + bf = basalforcingsismip6() + # or + bf = basalforcingsismip6(existing_obj_dict) # structtoobj equivalent + """ + + # --------------------- Constructor --------------------- + def __init__(self, *args): + # Defaults (match MATLAB) + self.num_basins = 0 + self.basin_id = np.nan + self.gamma_0 = 0.0 + self.tf = np.nan + self.tf_depths = np.nan + self.delta_t = np.nan + self.islocal = False + self.geothermalflux = np.nan + self.groundedice_melting_rate = np.nan + self.melt_anomaly = np.nan + + if len(args) == 0: + self.setdefaultparameters() + elif len(args) == 1: + self.setdefaultparameters() + # structtoobj: copy matching keys + src = args[0] + if isinstance(src, dict): + for k, v in src.items(): + if hasattr(self, k): + setattr(self, k, v) + else: + # Best-effort: copy attributes + for k in dir(src): + if not k.startswith("_") and hasattr(self, k): + setattr(self, k, getattr(src, k)) + else: + raise RuntimeError("constructor not supported") + + # --------------------- Methods ------------------------- + def extrude(self, md): + """ + Match MATLAB: + basin_id: element, layer=1 + tf: node (time series OK, handled as 2D [nNodes+1, nTimes]) + geothermalflux: element, layer=1 + groundedice_melting_rate: node, layer=1 + melt_anomaly: element, layer=1 + """ + # basin_id is element-wise scalar + self.basin_id = project3d(md, "vector", self.basin_id, "type", "element", "layer", 1) + + # tf: list/array over depths; each item is (nNodes+1, nTimes). + # Project node-wise vectors; keep the time axis intact. + if isinstance(self.tf, (list, tuple)): + new_tf = [] + for arr in self.tf: + if isinstance(arr, np.ndarray) and arr.ndim == 2: + # Last row is time; separate before projection + nodal = arr[:-1, :] + years = arr[-1:, :] + nodal_proj = project3d(md, "vector", nodal, "type", "node") + new_tf.append(np.vstack([nodal_proj, years])) + else: + new_tf.append(arr) + self.tf = new_tf + elif isinstance(self.tf, np.ndarray) and self.tf.ndim == 3: + # Optional: depth-major array; treat last row as years per slice + tf_list = [] + for iz in range(self.tf.shape[0]): + arr = self.tf[iz, :, :] + nodal = arr[:-1, :] + years = arr[-1:, :] + nodal_proj = project3d(md, "vector", nodal, "type", "node") + tf_list.append(np.vstack([nodal_proj, years])) + self.tf = tf_list + + # geothermalflux: element, bedrock only (layer=1) + if isinstance(self.geothermalflux, np.ndarray): + self.geothermalflux = project3d(md, "vector", self.geothermalflux, "type", "element", "layer", 1) + + # groundedice_melting_rate: node, layer=1 + if isinstance(self.groundedice_melting_rate, np.ndarray): + self.groundedice_melting_rate = project3d( + md, "vector", self.groundedice_melting_rate, "type", "node", "layer", 1 + ) + + # melt_anomaly: element, layer=1 + if isinstance(self.melt_anomaly, np.ndarray): + self.melt_anomaly = project3d(md, "vector", self.melt_anomaly, "type", "element", "layer", 1) + + return self + + def initialize(self, md): + # gamma_0 default if 0 + if self.gamma_0 == 0: + self.gamma_0 = 14477 + print(" no basalforcings.gamma_0 specified: value set to 14477 m/yr") + # groundedice_melting_rate default to zeros if NaN + if isinstance(self.groundedice_melting_rate, float) and np.isnan(self.groundedice_melting_rate): + self.groundedice_melting_rate = np.zeros(md.mesh.numberofvertices) + print(" no basalforcings.groundedice_melting_rate specified: values set as zero") + return self + + def setdefaultparameters(self): + self.gamma_0 = 14477.0 # m/yr + self.islocal = False + return self + + def checkconsistency(self, md, solution=None, analyses=None): + # num_basins + md = checkfield(md, fieldname="basalforcings.num_basins", numel=1, NaN=1, Inf=1, _gt=0) + + # basin_id ∈ [0, num_basins], element-sized + md = checkfield( + md, + fieldname="basalforcings.basin_id", + Inf=1, + _ge=0, + _le=md.basalforcings.num_basins, + size=[md.mesh.numberofelements, 1], + ) + + # gamma_0 > 0 + md = checkfield(md, fieldname="basalforcings.gamma_0", numel=1, NaN=1, Inf=1, _gt=0) + + # tf_depths: row vector, <= 0 (depths are non-positive) + md = checkfield(md, fieldname="basalforcings.tf_depths", NaN=1, Inf=1, size=[1, None], _le=0) + + # delta_t: length = num_basins, row vector + md = checkfield( + md, + fieldname="basalforcings.delta_t", + NaN=1, + Inf=1, + numel=md.basalforcings.num_basins, + size=[1, md.basalforcings.num_basins], + ) + + # islocal: boolean {0,1} + md = checkfield(md, fieldname="basalforcings.islocal", values=[0, 1]) + + # geothermalflux: timeseries on elements + md = checkfield(md, fieldname="basalforcings.geothermalflux", NaN=1, Inf=1, _ge=0, timeseries=1) + + # groundedice_melting_rate: timeseries on nodes + md = checkfield(md, fieldname="basalforcings.groundedice_melting_rate", NaN=1, Inf=1, timeseries=1) + + # melt_anomaly: only check if array is used (length>1) + + if np.size(self.melt_anomaly) > 1: + md = checkfield(md, fieldname="basalforcings.melt_anomaly", NaN=1, Inf=1, timeseries=1) + + + # tf cell structure: [1,1,num_depths], each cell (nNodes+1 x nTime) + depths = np.size(self.tf_depths) + md = checkfield(md, fieldname="basalforcings.tf", size=[1, 1, depths]) + # Validate each depth's matrix + def _matrix_ok(mat): + return ( + isinstance(mat, np.ndarray) + and mat.ndim == 2 + and mat.shape[0] == md.mesh.numberofvertices + 1 + ) + + if isinstance(self.tf, (list, tuple)) and len(self.tf) == depths: + for i in range(depths): + mat = self.tf[i] + if not _matrix_ok(mat): + raise ValueError( + f"basalforcings.tf[{i}] must be (nVertices+1) x nTime with last row = years." + ) + # MATLAB also checks NaN/Inf/>=0 and timeseries; rely on WriteData handling plus basic numeric sanity: + if not np.all(np.isfinite(mat)): + raise ValueError(f"basalforcings.tf[{i}] contains NaN/Inf.") + if np.any(mat[:-1, :] < 0): + raise ValueError(f"basalforcings.tf[{i}] has negative TF values (excluding last time row).") + else: + raise ValueError("basalforcings.tf must be a list of length numel(tf_depths).") + + return md + + def disp(self): + print(" ISMIP6 basal melt rate parameterization:") + fielddisplay(self, "num_basins", "number of basins the model domain is partitioned into [unitless]") + fielddisplay(self, "basin_id", "basin number assigned to each node (unitless)") + fielddisplay(self, "gamma_0", "melt rate coefficient (m/yr)") + fielddisplay(self, "tf_depths", "elevation of vertical layers in ocean thermal forcing dataset") + fielddisplay(self, "tf", "thermal forcing (ocean temperature minus freezing point) (degrees C)") + fielddisplay(self, "delta_t", "Ocean temperature correction per basin (degrees C)") + fielddisplay(self, "islocal", "boolean to use local ISMIP6 melt-rate parameterization (default false)") + fielddisplay(self, "geothermalflux", "geothermal heat flux (W/m^2)") + fielddisplay(self, "groundedice_melting_rate", "basal melting rate (positive if melting) (m/yr)") + fielddisplay(self, "melt_anomaly", "floating ice basal melt anomaly (m/yr)") + + def marshall(self, prefix, md, fid): + """ + Binary marshalling identical to MATLAB version. + Notes: + - basin_id is written 0-indexed (subtract 1). + - gamma_0 is scaled by 1/yts to convert from m/yr to m/s in the file. + - Time-series arrays use timeserieslength consistent with MATLAB: + tf, delta_t, groundedice_melting_rate: nVertices+1 + geothermalflux, melt_anomaly: nElements+1 + """ + yts = md.constants.yts + + # Model id = 7 (ISMIP6 basal melt parameterization) + WriteData(fid, prefix, name="md.basalforcings.model", data=7, format="Integer") + + WriteData(fid, prefix, obj=self, fieldname="num_basins", format="Integer") + WriteData( + fid, + prefix, + obj=self, + fieldname="basin_id", + data=(self.basin_id - 1), # 0-indexed + name="md.basalforcings.basin_id", + format="IntMat", + mattype=2, + ) + WriteData(fid, prefix, obj=self, fieldname="gamma_0", format="Double", scale=1.0 / yts) + WriteData(fid, prefix, obj=self, fieldname="tf_depths", format="DoubleMat", name="md.basalforcings.tf_depths") + + WriteData( + fid, + prefix, + obj=self, + fieldname="tf", + format="MatArray", + name="md.basalforcings.tf", + timeserieslength=md.mesh.numberofvertices + 1, + yts=yts, + ) + WriteData( + fid, + prefix, + obj=self, + fieldname="delta_t", + format="DoubleMat", + name="md.basalforcings.delta_t", + timeserieslength=md.mesh.numberofvertices + 1, + yts=yts, + ) + WriteData(fid, prefix, obj=self, fieldname="islocal", format="Boolean") + + WriteData( + fid, + prefix, + obj=self, + fieldname="geothermalflux", + format="DoubleMat", + name="md.basalforcings.geothermalflux", + mattype=1, + timeserieslength=md.mesh.numberofelements + 1, + yts=yts, + ) + WriteData( + fid, + prefix, + obj=self, + fieldname="groundedice_melting_rate", + format="DoubleMat", + mattype=1, + scale=1.0 / yts, + timeserieslength=md.mesh.numberofvertices + 1, + yts=yts, + ) + WriteData( + fid, + prefix, + obj=self, + fieldname="melt_anomaly", + format="DoubleMat", + mattype=1, + scale=1.0 / yts, + timeserieslength=md.mesh.numberofelements + 1, + yts=yts, + ) diff --git a/src/m/contrib/jkjhew/outflow.py b/src/m/contrib/jkjhew/outflow.py new file mode 100644 index 000000000..20ecb62ea --- /dev/null +++ b/src/m/contrib/jkjhew/outflow.py @@ -0,0 +1,46 @@ +import numpy as np + +def outflow(md): + """ + OUTFLOW - flag nodes on outflux boundary. + + Python translation of: + function flag = outflow(md) + A = md.mesh.segments(:,1); + B = md.mesh.segments(:,2); + Nx = -(md.mesh.y(A) - md.mesh.y(B)); + Ny = md.mesh.x(A) - md.mesh.x(B); + Vx = (md.initialization.vx(A) + md.initialization.vx(B))/2; + Vy = (md.initialization.vy(A) + md.initialization.vy(B))/2; + VdotN = Vx.*Nx + Vy.*Ny; + flag(A(find(VdotN>0))) = 1; + """ + + # Extract segment endpoints (convert to 0-based indexing if needed) + A = md.mesh.segments[:, 0].astype(int) + B = md.mesh.segments[:, 1].astype(int) + + # Handle potential 1-based indexing from ISSM .mat imports + if A.min() >= 1 and B.min() >= 1: + A = A - 1 + B = B - 1 + + # Compute outward normals (Nx, Ny) + Nx = -(md.mesh.y[A] - md.mesh.y[B]) + Ny = (md.mesh.x[A] - md.mesh.x[B]) + + # Average velocities at segment endpoints + Vx = 0.5 * (md.initialization.vx[A] + md.initialization.vx[B]) + Vy = 0.5 * (md.initialization.vy[A] + md.initialization.vy[B]) + + # Dot product of velocity and outward normal + VdotN = Vx * Nx + Vy * Ny + + # Initialize vertex flags + flag = np.zeros(md.mesh.numberofvertices, dtype=bool) + + # Mark vertices A for which flow is outward (V·N > 0) + out_idx = np.where(VdotN > 0)[0] + flag[A[out_idx]] = True + + return flag diff --git a/src/m/coordsystems/gmtmask.m b/src/m/coordsystems/gmtmask.m index d02982fcd..f7ff63888 100644 --- a/src/m/coordsystems/gmtmask.m +++ b/src/m/coordsystems/gmtmask.m @@ -46,6 +46,8 @@ gmt_select_options='-Ve -h0 -Df -R0/360/-90/90 -A0 -JQ180/200 -Nk/s/s/k/s'; [status,result]=system(['gmt select ./' filename_all ' ' gmt_select_options ' > ./' filename_oce]); if status~=0, + disp(['gmt select failed with: ' result]); + disp(['trying again with gmtselect']); %assume we are working with GMT 6.0.0 gmt_select_options='-h0 -Df -R0/360/-90/90 -A0 -JQ180/200 -Nk/s/s/k/s'; [status,result] = system(['gmtselect ./' filename_all ' ' gmt_select_options ' > ./' filename_oce]); diff --git a/src/m/coordsystems/gmtmask.py b/src/m/coordsystems/gmtmask.py index 742f33c33..c618152f2 100644 --- a/src/m/coordsystems/gmtmask.py +++ b/src/m/coordsystems/gmtmask.py @@ -52,6 +52,8 @@ def gmtmask(lat, long, *args): subproc = subprocess.Popen(subproc_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) outs, errs = subproc.communicate() if errs != '': + print('gmt select failed with: ' + result); + print('trying again with gmtselect'); # Assume we are working with GMT 6.0.0 gmt_select_options = '-h0 -Df -R0/360/-90/90 -A0 -JQ180/200 -Nk/s/s/k/s' subproc_cmd = 'gmtselect ./all_vertices.txt ' + gmt_select_options + ' > ./oce_vertices.txt' diff --git a/src/m/dev/issmversion.m b/src/m/dev/issmversion.m index 9e6919d41..75fb20248 100644 --- a/src/m/dev/issmversion.m +++ b/src/m/dev/issmversion.m @@ -22,4 +22,4 @@ disp(['Build date: ' IssmConfig('PACKAGE_BUILD_DATE')]); disp(['Compiled on ' IssmConfig('HOST_VENDOR') ' ' IssmConfig('HOST_OS') ' ' IssmConfig('HOST_ARCH') ' by ' IssmConfig('USER_NAME')]); disp([' ']); -disp(['Copyright (c) 2009-2025 California Institute of Technology (3-Clause BSD License)']); +disp(['Copyright (c) 2009-2026 California Institute of Technology (3-Clause BSD License)']); diff --git a/src/m/dev/issmversion.py b/src/m/dev/issmversion.py index 350951115..6f7844fb2 100644 --- a/src/m/dev/issmversion.py +++ b/src/m/dev/issmversion.py @@ -15,4 +15,4 @@ def issmversion(): print(('(website: ' + IssmConfig('PACKAGE_URL')[0] + ' contact: ' + IssmConfig('PACKAGE_BUGREPORT')[0] + ')')) print(' ') print(('Build date: ' + IssmConfig('PACKAGE_BUILD_DATE')[0])) -print('Copyright (c) 2009-2025 California Institute of Technology (3-Clause BSD License)') +print('Copyright (c) 2009-2026 California Institute of Technology (3-Clause BSD License)') diff --git a/src/m/mech/basalstress.m b/src/m/mech/basalstress.m index 5fc635a0c..4350c7dbe 100644 --- a/src/m/mech/basalstress.m +++ b/src/m/mech/basalstress.m @@ -8,23 +8,21 @@ % % See also: plot_basaldrag -%Check md.friction class -if ~isa(md.friction,'friction') - error('Error: md.friction only supports "friction.m" class.'); -end +%Compute effective pressure +g = md.constants.g; +rho_ice = md.materials.rho_ice; +rho_water = md.materials.rho_water; -%compute exponents -s=averaging(md,1./md.friction.p,0); -r=averaging(md,md.friction.q./md.friction.p,0); +sealevel = 0; +p_ice = g*rho_ice*md.geometry.thickness; -%Compute effective pressure -g =md.constants.g; -rho_ice =md.materials.rho_ice; -rho_water=md.materials.rho_water; +if isfield(md.friction, 'coupling') + coupling = md.friction.coupling; +else + coupling = 0; +end -sealevel=0; -p_ice=g*rho_ice*md.geometry.thickness; -switch(md.friction.coupling) +switch(coupling) case 0 p_water=g*rho_water*(sealevel-md.geometry.base); N = p_ice-p_water; @@ -48,7 +46,34 @@ uby=md.initialization.vy/md.constants.yts; %compute basal drag (S.I.) -alpha2 = (N.^r).*(md.friction.coefficient.^2).*(ub.^(s-1)); +switch(class(md.friction)) + case 'friction' + %compute exponents + s=averaging(md,1./md.friction.p,0); + r=averaging(md,md.friction.q./md.friction.p,0); + + alpha2 = (N.^r).*(md.friction.coefficient.^2).*(ub.^(s-1)); + + case 'frictionschoof' + if any(N < 0) + %NOTE: Sometimes, negative value of effective pressure N gives image number in alpha2. To prevent the image value in alpha2, we use small values. + warning('Find effective pressure value < 0. Treating minimum effective value with 0.1'); + N = max(N, 0.1); + end + m=averaging(md,md.friction.m,0); + C=averaging(md,md.friction.C,0); + Cmax=averaging(md,md.friction.Cmax,0); + + alpha2 = (C.^2 .* ub.^(m-1))./(1 + (C.^2./(Cmax.*N)).^(1./m).*ub).^(m); + + case 'frictionweertman' + m = averaging(md,md.friction.m,0); + C = md.friction.C; + alpha2 = C.^2 .* ub.^(1./m-1); + + otherwise + error('friction class not supported yet'); +end b = alpha2.*ub; bx = -alpha2.*ubx; by = -alpha2.*uby; diff --git a/src/m/mech/basalstress.py b/src/m/mech/basalstress.py index bf5a6e002..a99f2eeeb 100644 --- a/src/m/mech/basalstress.py +++ b/src/m/mech/basalstress.py @@ -1,4 +1,5 @@ from friction import friction +from frictionschoof import frictionschoof from averaging import averaging import numpy as np @@ -18,10 +19,6 @@ def basalstress(md): if not isinstance(md.friction,friction): raise Exception('Error: md.friction only supports "friction.m" class.') - #compute exponents - s=averaging(md,1/md.friction.p,0) - r=averaging(md,md.friction.q/md.friction.p,0) - #Compute effective pressure g =md.constants.g rho_ice =md.materials.rho_ice @@ -51,18 +48,35 @@ def basalstress(md): ub=np.sqrt(md.initialization.vx**2+md.initialization.vy**2)/md.constants.yts ubx=md.initialization.vx/md.constants.yts uby=md.initialization.vy/md.constants.yts + ub =np.ravel(ub) + ubx =np.ravel(ubx) + uby =np.ravel(uby) #compute basal drag (S.I.) #reshape array to vector (N,) - coefficient=np.ravel(md.friction.coefficient) N =np.ravel(N) - r =np.ravel(r) - s =np.ravel(s) - ub =np.ravel(ub) - ubx =np.ravel(ubx) - uby =np.ravel(uby) + + if isinstance(md.friction,friction): + #compute exponents + s=averaging(md,1/md.friction.p,0) + r=averaging(md,md.friction.q/md.friction.p,0) + coefficient=np.ravel(md.friction.coefficient) + r =np.ravel(r) + s =np.ravel(s) + + alpha2 = (N**r)*(md.friction.coefficient**2)*(ub**(s-1)) + elif isinstance(md.friction,frictionschoof): + if np.any(N<0): + #NOTE: Sometimes, N negative values gives image number in alpha2. To prevent the image value in alpha2, we use small values. + N = np.maximum(N,0.1) + m=averaging(md,md.friction.m,0) + C=averaging(md,md.friction.C,0) + Cmax=averaging(md,md.friction.Cmax,0) + + alpha2 = (C**2 * ub**(m-1))/(1 + (C**2/(Cmax*N))**(1/m)*ub)**m + else: + raise Exception('not supported yet') - alpha2 = (N**r)*(md.friction.coefficient**2)*(ub**(s-1)) b = alpha2*ub bx = -alpha2*ubx by = -alpha2*uby diff --git a/src/m/mech/cfl_step.m b/src/m/mech/cfl_step.m index 7305494de..b7ff5e2fe 100755 --- a/src/m/mech/cfl_step.m +++ b/src/m/mech/cfl_step.m @@ -11,7 +11,7 @@ %Check length of velocities if size(vx,1)~=md.mesh.numberofvertices & size(vy,1)~=md.mesh.numberofvertices, - error('timestpes error message: size of velocity components must be the same as md.mesh.numberofvertices'); + error('timesteps error message: size of velocity components must be the same as md.mesh.numberofvertices'); end index=md.mesh.elements; diff --git a/src/m/mech/cfl_step.py b/src/m/mech/cfl_step.py index 642462485..34d288f17 100644 --- a/src/m/mech/cfl_step.py +++ b/src/m/mech/cfl_step.py @@ -13,13 +13,13 @@ def cfl_step(md, vx, vy): import numpy as np # Return the maximum time step for the model in years if vx.shape[0] != md.mesh.numberofvertices and vy.shape[0] != md.mesh.numberofvertices: - sys.exit('timestpes error message: size of velocity components must be the same as md.mesh.numberofvertices') + sys.exit('timesteps error message: size of velocity components must be the same as md.mesh.numberofvertices') index = md.mesh.elements - edgex = np.nanmax(md.mesh.x[index-1],axis=1) - np.nanmin(md.mesh.x[index-1],axis=1) - edgey = np.nanmax(md.mesh.y[index-1],axis=1) - np.nanmin(md.mesh.y[index-1],axis=1) - vx = np.nanmax(np.abs(vx[index-1]),axis=1) - vy = np.nanmax(np.abs(vy[index-1]),axis=1) + edgex = np.nanmax(md.mesh.x[index-1], axis=1) - np.nanmin(md.mesh.x[index-1], axis=1) + edgey = np.nanmax(md.mesh.y[index-1], axis=1) - np.nanmin(md.mesh.y[index-1], axis=1) + vx = np.nanmax(np.abs(vx[index-1]), axis=1) + vy = np.nanmax(np.abs(vy[index-1]), axis=1) maxtime = 1/2 * np.nanmin(1/(vx/edgex + vy/edgey)) return maxtime diff --git a/src/m/mesh/bamg.py b/src/m/mesh/bamg.py index 231b9b9a1..c6c982fa0 100644 --- a/src/m/mesh/bamg.py +++ b/src/m/mesh/bamg.py @@ -592,7 +592,11 @@ def bamg(md, *args): md.mesh.elementconnectivity = md.mesh.elementconnectivity.astype(int) # Check for orphan - if np.any(np.logical_not(np.in1d(np.arange(1, md.mesh.numberofvertices + 1), md.mesh.elements.flat))): + if hasattr(np, 'isin'): #Numpy 2017+ + tmp = np.isin(np.arange(1, md.mesh.numberofvertices + 1), md.mesh.elements.flat) + else: #For backward compatibility + tmp = np.in1d(np.arange(1, md.mesh.numberofvertices + 1), md.mesh.elements.flat) + if np.any(np.logical_not(tmp)): raise RuntimeError('Output mesh has orphans. Check your Domain and/or RequiredVertices') return md diff --git a/src/m/mesh/findsegments.py b/src/m/mesh/findsegments.py index 2836b70ea..fa5c238e2 100644 --- a/src/m/mesh/findsegments.py +++ b/src/m/mesh/findsegments.py @@ -55,7 +55,11 @@ def findsegments(md, *args): # {{{ flag = intersect(md.mesh.elements[els2[0] - 1, :], md.mesh.elements[els2[1] - 1, :])[0] # NOTE: Throwing away second- and third- position values returned from call # Get the vertices on the boundary and build segment - nods1 = np.delete(nods1, np.where(np.in1d(nods1, flag, assume_unique=True))) + if hasattr(np, 'isin'): #Numpy 2017+ + tmp = np.isin(nods1, flag, assume_unique=True) + else: #For backward compatibility + tmp = np.in1d(nods1, flag, assume_unique=True) + nods1 = np.delete(nods1, np.where()) segments[count, :] = np.append(nods1, el1 + 1) # Swap segment nodes if necessary @@ -79,7 +83,11 @@ def findsegments(md, *args): # {{{ for j in range(3): nods = nods1 nods = np.delete(nods, j) - if np.any(np.in1d(flag, nods)): + if hasattr(np, 'isin'): #Numpy 2017+ + tmp = np.isin(flag, nods) + else: #For backward compatibility + tmp = np.in1d(flag, nods) + if np.any(tmp): segments[count, :] = np.append(nods, el1 + 1) # Swap segment nodes if necessary diff --git a/src/m/miscellaneous/MatlabFuncs.py b/src/m/miscellaneous/MatlabFuncs.py index 7eb375692..970680e4d 100644 --- a/src/m/miscellaneous/MatlabFuncs.py +++ b/src/m/miscellaneous/MatlabFuncs.py @@ -217,7 +217,10 @@ def ismember(a, s): # {{{ for i, item in enumerate(a.flat): b[i] = item in s else: - b = np.in1d(a.flat, s.flat).reshape(a.shape) + if hasattr(np, 'isin'): #Numpy 2017+ + b = np.isin(a.flat, s.flat).reshape(a.shape) + else: #For backward compatibility + b = np.in1d(a.flat, s.flat).reshape(a.shape) return b # }}} diff --git a/src/m/modeldata/interpBedmachineAntarctica.py b/src/m/modeldata/interpBedmachineAntarctica.py new file mode 100644 index 000000000..4c4c1ea7e --- /dev/null +++ b/src/m/modeldata/interpBedmachineAntarctica.py @@ -0,0 +1,303 @@ +# interp_bedmachine_antarctica.py +from __future__ import annotations + +from pathlib import Path +import os +import numpy as np +from netCDF4 import Dataset + +# SciPy is optional but recommended for 'cubic' +try: + from scipy.interpolate import RegularGridInterpolator, RectBivariateSpline + _HAVE_SCIPY = True +except Exception: + _HAVE_SCIPY = False + + +def interp_bedmachine_antarctica(X, Y, string="bed", method=None, ncdate="v3"): + """ + Python port of interpBedmachineAntarctica(X,Y,string,method,ncdate) + + Parameters + ---------- + X, Y : array-like + Target coordinates (same shape) in the BedMachine (EPSG:3031) grid units (meters). + string : {"bed","surface","thickness","mask","source",...,"icemask"} + Variable name in the NetCDF, plus special case "icemask". + method : {"nearest","linear","cubic"} or None + Interpolation method. If None: 'nearest' for mask/source, else 'cubic'. + ncdate : str + Either a BedMachine version tag (e.g. "v3.5") to resolve common paths, + or a full path to a specific .nc file. + + Returns + ------- + output : ndarray + Interpolated values with the same shape as X and Y. + """ + if method is None: + if string in ("mask", "source"): + method = "nearest" + else: + method = "cubic" # default, like MATLAB + + # Resolve dataset path + basename = "BedMachineAntarctica" + if (str(ncdate).endswith(".nc") and Path(ncdate).exists()) or Path(ncdate).is_file(): + ncfile = str(ncdate) + version_str = Path(ncfile).stem.replace(f"{basename}-", "") + else: + version_str = str(ncdate) + candidates = [ + f"/u/astrid-r1b/ModelData/BedMachine/{basename}-{version_str}.nc", + f"/home/ModelData/Antarctica/BedMachine/{basename}-{version_str}.nc", + f"/totten_1/ModelData/Antarctica/BedMachine/{basename}-{version_str}.nc", + f"/local/ModelData/BedMachineAntarctica/{basename}-{version_str}.nc", + f"/Users/larour/ModelData/BedMachine/{basename}-{version_str}.nc", + f"/Users/u7322062/Downloads/{basename}-{ncdate}.nc", + f"./{basename}-{version_str}.nc", + ] + ncfile = None + for p in candidates: + if Path(p).exists(): + ncfile = p + break + if ncfile is None: + raise FileNotFoundError( + f"Could not find {basename}-{version_str}.nc; add its path to the list " + "or pass a full path as ncdate." + ) + + print(f" -- BedMachine Antarctica version: {version_str}") + + # Load axes + with Dataset(ncfile, "r") as ds: + xdata = np.array(ds.variables["x"][:], dtype=float) + ydata = np.array(ds.variables["y"][:], dtype=float) + + # Window the read like MATLAB (with a small border offset) + offset = 2 + Xr = np.asarray(X, dtype=float) + Yr = np.asarray(Y, dtype=float) + xmin, xmax = np.nanmin(Xr), np.nanmax(Xr) + ymin, ymax = np.nanmin(Yr), np.nanmax(Yr) + + posx = np.where(xdata <= xmax)[0] + if posx.size == 0: + posx = np.array([xdata.size - 1]) + id1x = max(0, int(np.searchsorted(xdata, xmin, side="left") - 1 - offset + 1)) # mimic find >= xmin, then -offset + id2x = min(xdata.size - 1, int(posx[-1] + offset)) + + posy = np.where(ydata >= ymin)[0] + if posy.size == 0: + posy = np.array([ydata.size - 1]) + # in MATLAB: id1y uses first index of ydata<=ymax (so it's "left" in descending/asc mix); + # here we assume ascending y; emulate robustly: + id1y = max(0, int(np.searchsorted(ydata, ymin, side="left") - 1 - offset + 1)) + id2y = min(ydata.size - 1, int(np.searchsorted(ydata, ymax, side="right") - 1 + offset)) + + # Safe slice ranges + xslice = slice(id1x, id2x + 1) + yslice = slice(id1y, id2y + 1) + + + # Load the requested variable (transpose like MATLAB) + varname = "mask" if string == "icemask" else string + print(f" -- BedMachine Antarctica: loading {string}") + # --- Load the requested variable with correct axis order ----------------- + #print(f" -- BedMachine Antarctica: loading {string}") + with Dataset(ncfile, "r") as ds: + if varname not in ds.variables: + raise KeyError(f"Variable '{varname}' not found in {ncfile}") + v = ds.variables[varname] + + # BedMachine vars can be saved as (y, x) or (x, y). Normalize to (y, x). + dims = tuple(v.dimensions) + + # Build slices for each axis in the variable + # We’ll map our xslice/yslice onto the correct positions. + def _read_window_xy_as_yx(var): + # Try to detect names 'x'/'y' in v.dimensions + if "y" in dims and "x" in dims: + yi = dims.index("y") + xi = dims.index("x") + # Construct slice tuple in var's native order + sl = [slice(None)] * var.ndim + sl[yi] = yslice + sl[xi] = xslice + arr = np.array(var[tuple(sl)], dtype=float) + # Now ensure final array is (y, x): move axes if needed + if yi > xi: + # arr axes are (..., x, y, ...). Bring y to axis 0 and x to axis 1 + arr = np.moveaxis(arr, [yi, xi], [0, 1]) + else: + # arr axes are (..., y, x, ...). Bring y->0, x->1 + arr = np.moveaxis(arr, [yi, xi], [0, 1]) + # If there were extra leading dims, squeeze them out + arr = np.squeeze(arr) + else: + # Fallback: assume last 2 dims are (y, x) + arr = np.array(var[...], dtype=float) + arr = np.squeeze(arr) + if arr.ndim < 2: + raise ValueError(f"Variable '{var.name}' is not at least 2-D.") + arr = arr[yslice, xslice] + return arr + + data = _read_window_xy_as_yx(v) # data now intended to be (y, x) + + # Windowed grid vectors + xw = xdata[xslice] + yw = ydata[yslice] + + # MATLAB code transposed after read; we’ve already normalized to (y, x). + # Apply 'icemask' post-processing exactly like MATLAB. + if string == "icemask": + data = data.copy() + data[data == 3] = 0 + + # Ensure axes are strictly ascending for interpolators. Flip data if needed. + if xw.size > 1 and xw[1] < xw[0]: + xw = xw[::-1] + data = data[:, ::-1] + if yw.size > 1 and yw[1] < yw[0]: + yw = yw[::-1] + data = data[::-1, :] + + # --- Interpolate (data must be (len(yw), len(xw))) ---------------------- + print(f" -- BedMachine Antarctica: interpolating {string}") + print(f" -- Interpolation method: {method}") + if string in ("mask", "source"): + output = _interp_from_grid(xw, yw, data, Xr, Yr, method="nearest") + else: + output = _interp_from_grid(xw, yw, data, Xr, Yr, method=method) + return output + + +def _interp_from_grid(x, y, data, X, Y, method="cubic"): + """ + Emulates ISSM's InterpFromGrid(x,y,data,X,Y,method) with: + - 'nearest' / 'linear' via RegularGridInterpolator (if SciPy) or FastInterp fallback + - 'cubic' via RectBivariateSpline (SciPy). Falls back to 'linear' if SciPy unavailable. + Inputs: + x, y: 1D axes (ascending), data shape = (len(y), len(x)) [we've transposed to match this] + X, Y: target arrays (same shape) + """ + x = np.asarray(x, dtype=float) + y = np.asarray(y, dtype=float) + Z = np.asarray(data, dtype=float) + Xp = np.asarray(X, dtype=float) + Yp = np.asarray(Y, dtype=float) + + if method == "nearest": + if _HAVE_SCIPY: + rgi = RegularGridInterpolator( + (y, x), Z, method="nearest", bounds_error=False, fill_value=np.nan + ) + out = rgi(np.column_stack([Yp.ravel(), Xp.ravel()])) + return out.reshape(Xp.shape) + # Fallback: nearest via FastInterp + return _fast_interp(x, y, Z, Xp, Yp, method="nearest") + + if method == "linear": + if _HAVE_SCIPY: + rgi = RegularGridInterpolator( + (y, x), Z, method="linear", bounds_error=False, fill_value=np.nan + ) + out = rgi(np.column_stack([Yp.ravel(), Xp.ravel()])) + return out.reshape(Xp.shape) + # Fallback: bilinear via FastInterp + return _fast_interp(x, y, Z, Xp, Yp, method="bilinear") + + if method == "cubic": + if _HAVE_SCIPY: + # RectBivariateSpline expects strictly ascending axes + rbs = RectBivariateSpline(y, x, Z, kx=3, ky=3) + out = rbs.ev(Yp.ravel(), Xp.ravel()).reshape(Xp.shape) + return out + # No SciPy: degrade gracefully to linear + return _fast_interp(x, y, Z, Xp, Yp, method="bilinear") + + # Unknown method -> try linear as a sane default + if _HAVE_SCIPY: + rgi = RegularGridInterpolator( + (y, x), Z, method="linear", bounds_error=False, fill_value=np.nan + ) + out = rgi(np.column_stack([Yp.ravel(), Xp.ravel()])) + return out.reshape(Xp.shape) + return _fast_interp(x, y, Z, Xp, Yp, method="bilinear") + + +def _fast_interp(x, y, Z, X, Y, method="bilinear"): + """ + Vectorized reproduction of MATLAB FastInterp: + - method='nearest' or 'bilinear' + Assumes: + - x, y are 1D ascending + - Z has shape (len(y), len(x)) [row=y, col=x] + - X, Y broadcastable / same shape for output + """ + M, N = Z.shape # rows=ny, cols=nx + x0, y0 = x[0], y[0] + dx = x[1] - x[0] + dy = y[1] - y[0] + ndx = 1.0 / dx + ndy = 1.0 / dy + + xi = (X - x0) * ndx + yi = (Y - y0) * ndy + + out = np.full_like(X, np.nan, dtype=float) + + if method == "nearest": + rxi = np.rint(xi).astype(int) + 1 # MATLAB 1-based + ryi = np.rint(yi).astype(int) + 1 + # In-bounds mask (1..N / 1..M) + mask = (rxi > 0) & (rxi <= N) & np.isfinite(rxi) & (ryi > 0) & (ryi <= M) & np.isfinite(ryi) + # Convert to 0-based indices + j = np.clip(rxi - 1, 0, N - 1) + i = np.clip(ryi - 1, 0, M - 1) + out[mask] = Z[i[mask], j[mask]] + return out + + # bilinear + fxi = np.floor(xi).astype(int) + 1 # 1-based xi + fyi = np.floor(yi).astype(int) + 1 # 1-based yi + dfxi = xi - (fxi - 1) + dfyi = yi - (fyi - 1) + + mask = ( + (fxi > 0) & (fxi < N) & np.isfinite(fxi) & + (fyi > 0) & (fyi < M) & np.isfinite(fyi) + ) + if not np.any(mask): + return out + + fxi0 = np.clip(fxi[mask] - 1, 0, N - 1) # -> 0-based + fyi0 = np.clip(fyi[mask] - 1, 0, M - 1) + dfxi_m = dfxi[mask] + dfyi_m = dfyi[mask] + + # Four neighbors + i1 = fyi0 + j1 = fxi0 + i2 = fyi0 + j2 = np.clip(fxi0 + 1, 0, N - 1) + i3 = np.clip(fyi0 + 1, 0, M - 1) + j3 = np.clip(fxi0 + 1, 0, N - 1) + i4 = np.clip(fyi0 + 1, 0, M - 1) + j4 = fxi0 + + z1 = Z[i1, j1] + z2 = Z[i2, j2] + z3 = Z[i3, j3] + z4 = Z[i4, j4] + + out_m = ( + z1 * (1 - dfxi_m) * (1 - dfyi_m) + + z2 * (dfxi_m) * (1 - dfyi_m) + + z4 * (1 - dfxi_m) * (dfyi_m) + + z3 * (dfxi_m) * (dfyi_m) + ) + out[mask] = out_m + return out diff --git a/src/m/modeldata/interpMouginotAnt2017.py b/src/m/modeldata/interpMouginotAnt2017.py new file mode 100644 index 000000000..6dbd3e6f0 --- /dev/null +++ b/src/m/modeldata/interpMouginotAnt2017.py @@ -0,0 +1,130 @@ +import os +import numpy as np +from netCDF4 import Dataset +from scipy.interpolate import RegularGridInterpolator + +def interp_mouginot_ant2017(X, Y, *, speed=False, method="nearest", fill_value=np.nan): + """ + Interpolate Mouginot et al. (Antarctica) velocities onto points (X, Y). + + Parameters + ---------- + X, Y : array_like + Target coordinates (same shape). These should be in the dataset's x/y + coordinate system (EPSG:3031 for the common NSIDC grid). + speed : bool, default False + If True, return speed (sqrt(VX^2 + VY^2)) as a single array. + If False, return (VX, VY). + method : {"linear","nearest"} + Interpolation method. + fill_value : float + Value for points outside the data domain. + + Returns + ------- + VX, VY : ndarray (if speed=False) + Interpolated components matching the shape of X. + or + S : ndarray (if speed=True) + Interpolated speed. + """ + # --- Choose file by hostname (like MATLAB switch) ------------------------- + host = os.uname().nodename + if host == "ronne": + nc_path = "/home/ModelData/Antarctica/MouginotVel/vel_nsidc.CF16_2.nc" + elif host == "totten": + nc_path = "/totten_1/ModelData/Antarctica/MouginotVel/vel_nsidc.CF16_2.nc" + elif host == "amundsen.thayer.dartmouth.edu": + nc_path = "/local/ModelData/AntarcticVelocity/v_mix.v13Mar2019.nc" + elif host == "nri-085597": + nc_path = "/Users/u7322062/Downloads/antarctica_ice_velocity_450m_v2.nc" + else: + raise RuntimeError(f"hostname not supported yet: {host!r}") + + X = np.asarray(X, dtype=float) + Y = np.asarray(Y, dtype=float) + if X.shape != Y.shape: + raise ValueError("X and Y must have the same shape.") + + offset = 2 # match MATLAB + + with Dataset(nc_path, "r") as ds: + xdata = np.array(ds.variables["x"][:], dtype=float) # (nx,) + ydata = np.array(ds.variables["y"][:], dtype=float) # (ny,) + + # Determine if axes are ascending; if not, remember to flip slices. + x_asc = np.all(np.diff(xdata) > 0) + y_asc = np.all(np.diff(ydata) > 0) + + xmin, xmax = np.nanmin(X), np.nanmax(X) + ymin, ymax = np.nanmin(Y), np.nanmax(Y) + + # Helper to get [i1, i2] inclusive bounds with padding for a 1D axis + def _bounds(axis, vmin, vmax, ascending): + n = axis.size + if ascending: + i1 = max(0, int(np.searchsorted(axis, vmin, side="left")) - offset) + i2 = min(n - 1, int(np.searchsorted(axis, vmax, side="right") - 1 + offset)) + else: + # For descending arrays, invert the logic + # Use -axis to leverage searchsorted on ascending data + neg = -axis + i1 = max(0, int(np.searchsorted(neg, -vmax, side="left")) - offset) + i2 = min(n - 1, int(np.searchsorted(neg, -vmin, side="right") - 1 + offset)) + if i1 > i2: + raise ValueError("Requested window is outside data domain.") + return i1, i2 + + id1x, id2x = _bounds(xdata, xmin, xmax, x_asc) + id1y, id2y = _bounds(ydata, ymin, ymax, y_asc) + + # Slice coordinate vectors + xs = xdata[id1x:id2x + 1] + ys = ydata[id1y:id2y + 1] + + # Read VX/VY slices; file variables are (y, x) or (x, y) depending on product. + # The MATLAB code transposes after read, implying file layout was (x,y) -> they wanted (y,x). + # We'll read in [y, x] order and ensure arrays end up as (ny, nx) with ys, xs. + # netCDF4 slicing is [y, x] if variable dims are ('y','x'); we'll try that first. + def _read_var(name): + var = ds.variables[name] + # Guess dim order + dims = var.dimensions # tuple of names + if len(dims) != 2: + raise ValueError(f"Variable {name} has unexpected dims: {dims}") + # Build slices per order + if dims[0].lower().startswith("y") and dims[1].lower().startswith("x"): + arr = np.array(var[id1y:id2y + 1, id1x:id2x + 1], dtype=float) + elif dims[0].lower().startswith("x") and dims[1].lower().startswith("y"): + arr = np.array(var[id1x:id2x + 1, id1y:id2y + 1], dtype=float).T + else: + # Fallback: assume (y,x) + arr = np.array(var[id1y:id2y + 1, id1x:id2x + 1], dtype=float) + return arr + + vx_slice = _read_var("VX") + vy_slice = _read_var("VY") + + # Make sure axes are ascending for RegularGridInterpolator + if not x_asc: + xs = xs[::-1] + vx_slice = vx_slice[:, ::-1] + vy_slice = vy_slice[:, ::-1] + if not y_asc: + ys = ys[::-1] + vx_slice = vx_slice[::-1, :] + vy_slice = vy_slice[::-1, :] + + # Build interpolators on (ys, xs) -> data[ny, nx] + rgi_vx = RegularGridInterpolator((ys, xs), vx_slice, method=method, + bounds_error=False, fill_value=fill_value) + rgi_vy = RegularGridInterpolator((ys, xs), vy_slice, method=method, + bounds_error=False, fill_value=fill_value) + + pts = np.column_stack([Y.ravel(), X.ravel()]) # note order: (y, x) + vx = rgi_vx(pts).reshape(X.shape) + vy = rgi_vy(pts).reshape(X.shape) + + if speed: + return np.hypot(vx, vy) + return vx, vy diff --git a/src/m/modeldata/interpSeaRISE.py b/src/m/modeldata/interpSeaRISE.py new file mode 100644 index 000000000..d246cf3b4 --- /dev/null +++ b/src/m/modeldata/interpSeaRISE.py @@ -0,0 +1,143 @@ +from __future__ import annotations +from pathlib import Path +from typing import Optional, Tuple +import numpy as np +from netCDF4 import Dataset + +from xy2ll import xy2ll +from ll2xy import ll2xy +try: + from InterpFromGridToMesh import InterpFromGridToMesh # returns (Fq, in_mesh) +except ImportError: + InterpFromGridToMesh = None + +# interp_searise.py +# robust_interp_searise.py +import socket +import numpy as np + + + +def _default_searise_path(hemisphere: int) -> str: + host = socket.gethostname() + if host in {"ronne"}: + return "/home/ModelData/SeaRISE/Greenland_5km_dev1.2.nc" if hemisphere==+1 else "/home/ModelData/SeaRISE/Antarctica_5km_dev1.0.nc" + if host in {"thwaites","larsen","murdo","astrid"}: + return "/u/astrid-r1b/ModelData/SeaRISE/Greenland5km_v1.2/Greenland_5km_dev1.2.nc" if hemisphere==+1 else "/u/astrid-r1b/ModelData/SeaRISE/Antarctica5km_shelves_v1.0/Antarctica_5km_dev1.0.nc" + if host in {"totten"}: + return "/totten_1/ModelData/SeaRISE/Greenland_5km_dev1.2.nc" if hemisphere==+1 else "/totten_1/ModelData/SeaRISE/Antarctica_5km_dev1.0.nc" + if host in {"nri-085597"}: + return "aq1_01_20.nc" if hemisphere==+1 else "aq1_01_20.nc" + raise RuntimeError(f"hostname '{host}' not supported; pass ncfile=") + + +def _prepare_grid(xdata, ydata, raw): + """Return (x, y, data_yx) so that: + - x.shape=(nx,), y.shape=(ny,) + - data_yx.shape=(ny, nx) matches InterpFromGrid(y,x) convention + - axes strictly increasing; data reindexed if we reversed an axis + """ + x = np.asarray(xdata).astype(float).ravel() + y = np.asarray(ydata).astype(float).ravel() + A = np.asarray(raw).astype(float) + + # Handle potential trailing dims (e.g., (ny, nx, 1)) + while A.ndim > 2 and 1 in A.shape: + A = np.squeeze(A) + + # Decide whether to transpose based on shapes + if A.shape == (y.size, x.size): + data_yx = A + elif A.shape == (x.size, y.size): + data_yx = A.T + else: + # Fall back: if one dim matches x and the other matches y, permute + if x.size in A.shape and y.size in A.shape and A.ndim == 2: + ix = A.shape.index(y.size) + jx = A.shape.index(x.size) + data_yx = A if (ix == 0 and jx == 1) else A.transpose() + else: + raise ValueError(f"Unexpected data shape {A.shape}; x={x.size}, y={y.size}") + + # Ensure axes are increasing, and permute data accordingly + if np.any(np.diff(x) < 0): + x = x[::-1] + data_yx = data_yx[:, ::-1] + if np.any(np.diff(y) < 0): + y = y[::-1] + data_yx = data_yx[::-1, :] + + # Heuristic: SeaRISE coords are meters; if values look like km, scale up + # (e.g., max ~3500 suggests km for Antarctica domain) + if np.nanmax(np.abs(x)) < 10000 and np.nanmax(np.abs(y)) < 10000: + x = x * 1000.0 + y = y * 1000.0 + + return x, y, data_yx + + +def interp_searise(X, Y, varname, hemisphere=+1, ncfile=None, verbose=False): + if ncfile is None: + ncfile = _default_searise_path(hemisphere) + + X = np.asarray(X) + Y = np.asarray(Y) + xq = X.ravel().astype(float) + yq = Y.ravel().astype(float) + + # Projection logic: matches your MATLAB exactly + if hemisphere == +1: + LAT, LON = xy2ll(xq, yq, +1, 45, 70) + xproj, yproj = ll2xy(LAT, LON, +1, 39, 71) + elif hemisphere == -1: + xproj, yproj = xq, yq + else: + raise ValueError("hemisphere must be +1 (Greenland) or -1 (Antarctica)") + + with Dataset(ncfile, "r") as ds: + xdata = ds.variables["rlon"][:] + ydata = ds.variables["rlat"][:] + raw = ds.variables[varname][:] + + A = np.asarray(raw) + + # --- NEW: collapse trivial dimensions so RACMO shapes like + # (nt, 1, ny, nx) become (nt, ny, nx) ----------------------------- + # First, special-case 4D with a singleton 2nd dim (time,1,y,x) + if A.ndim == 4 and A.shape[1] == 1: + A = A[:, 0, :, :] # -> (nt, ny, nx) + + # Then, for anything >=3D, squeeze any remaining size-1 dims + # but keep time axis intact in typical (nt, ny, nx) case. + if A.ndim > 2 and 1 in A.shape: + A = np.squeeze(A) + # ------------------------------------------------------------------ + + # Now interpret shape + if A.ndim == 3: + # Assume (nt, ny, nx): take climatological mean over time + if verbose: + print( + f"interp_searise: '{varname}' is 3D {A.shape}, " + "taking nanmean over time axis 0 → 2D field" + ) + raw2d = np.nanmean(A, axis=0) + elif A.ndim == 2: + raw2d = A + else: + raise ValueError( + f"interp_searise: cannot handle '{varname}' with ndim={A.ndim}, " + f"shape={A.shape}" + ) + + # Auto-fix orientation & axis order for (x, y, data_yx) + xg, yg, data_yx = _prepare_grid(xdata, ydata, raw2d) + + # Interp (nearest for LandMask, linear otherwise) – identical to MATLAB call + if varname.lower() == "landmask": + vals = InterpFromGridToMesh(xg, yg, data_yx, xproj, yproj, 0, "nearest") + else: + vals = InterpFromGridToMesh(xg, yg, data_yx, xproj, yproj, 0) + + return vals.reshape(X.shape) + diff --git a/src/m/modules/Scotch.m b/src/m/modules/Scotch.m deleted file mode 100644 index 22e0f1b62..000000000 --- a/src/m/modules/Scotch.m +++ /dev/null @@ -1,14 +0,0 @@ -function [maptab] = Scotch(varargin); -%SCOTCH - Scotch partitioner -% -% Usage: -% [maptab]=Scotch(adjmat,vertlb,vertwt,edgewt,archtyp,archpar,Scotch-specific parameters); - -% Check usage -if nargin<6 - help Scotch - error('Wrong usage (see above)'); -end - -% Call mex module -[maptab]=Scotch_matlab(varargin{:}); diff --git a/src/m/modules/Scotch.py b/src/m/modules/Scotch.py deleted file mode 100644 index c4c248b80..000000000 --- a/src/m/modules/Scotch.py +++ /dev/null @@ -1,13 +0,0 @@ -from Scotch_python import Scotch_python - - -def Scotch(*varargin): - '''SCOTCH - Scotch partitioner - - Usage: - maptab = Scotch(adjmat, vertlb, vertwt, edgewt, archtyp, archpar, Scotch - specific parameters) -''' - # Call mex module - maptab = Scotch_python(*varargin) - - return maptab diff --git a/src/m/modules/ShpRead.m b/src/m/modules/ShpRead.m deleted file mode 100644 index 8594f2342..000000000 --- a/src/m/modules/ShpRead.m +++ /dev/null @@ -1,19 +0,0 @@ -function structout = ShpRead(filename); -% SHPREAD - Read shapefile -% -% This module reads shapefiles and converts them to matlab/python structures -% -% Usage: -% structout = ShpRead(filename); -% -% Examples: -% structout = ShpRead('file.shp'); - -% Check usage -if nargin~=1 - help ShpRead - error('Wrong usage: No file specified'); -end - -% Call mex module -structout = ShpRead_matlab(filename); diff --git a/src/m/os/issmbbftpin.m b/src/m/os/issmbbftpin.m deleted file mode 100644 index 4eb3f7088..000000000 --- a/src/m/os/issmbbftpin.m +++ /dev/null @@ -1,41 +0,0 @@ -function issmbbftpin(host, login,port,numstreams,path, packages) -%BBFTPIN get packages from host, using bbftp. assuming unix system here. -% -% usage: scpin(host,packages,path) -% - -%first get hostname -hostname=oshostname(); - -%first be sure packages are not in the current directory, this could conflict with pscp on windows. -for i=1:numel(packages), - if exist(packages{i},'file'), - delete(packages{i}); - end -end - -%if hostname and host are the same, do a simple copy -if strcmpi(hostname,host), - - for i=1:numel(packages), - success=copyfile([path '/' packages{i}]); %keep going, even if success=0 - end - -else - - %build a string of the type: bbftp -s -u elarour -e 'setnbstream 8; cd /nobackupp10/elarour/Testing/Interactive3/; get Antarctica.outbin' pfe1.nas.nasa.gov - command=['!bbftp -s -V -u ' login ' -e ''setnbstream 8; cd ' path '; ']; - for i=1:numel(packages), - command=[command 'get ' packages{i} ';']; - end - command=[command ''' pfe22.nas.nasa.gov']; - - eval(command); - - %check bbftp worked - for i=1:numel(packages), - if ~exist(['./' packages{i}],'file'), - error('scpin error message: could not call scp on *nix system'); - end - end -end diff --git a/src/m/os/issmbbftpout.m b/src/m/os/issmbbftpout.m deleted file mode 100644 index 06cae34eb..000000000 --- a/src/m/os/issmbbftpout.m +++ /dev/null @@ -1,30 +0,0 @@ -function issmbbftpout(host,path,login,port,numstreams,packages) -%BBFTPOUT put packages onto host, using bbftp. assuming unix system here. -% -% usage: bbftpout(host,path,login,port,numstream,packages) -% -% - -%get hostname -hostname=oshostname(); - -%if hostname and host are the same, do a simple copy -if strcmpi(host,hostname), - for i=1:numel(packages), - here=pwd; - eval(['cd ' path]) - system(['rm -rf ' packages{i} ]); - system(['ln -s ' here '/' packages{i} ' .']); - eval(['cd ' here]); - end -else - - %build a string of the type: bbftp -s -u elarour -e 'setnbstream 8; cd /nobackupp10/elarour/Testing/Interactive3/; put Antarctica.tar.gz' pfe1.nas.nasa.gov - command=['!bbftp -s -V -u ' login ' -e ''setnbstream 8; cd ' path '; ']; - for i=1:length(packages), - command=[command 'put ' packages{i} ';']; - end - command=[command ''' pfe22.nas.nasa.gov']; - - eval(command); -end diff --git a/src/m/os/issmscpin.py b/src/m/os/issmscpin.py index 53cd275e6..9838b38dd 100644 --- a/src/m/os/issmscpin.py +++ b/src/m/os/issmscpin.py @@ -10,7 +10,7 @@ def issmscpin(host, login, port, path, packages=1): Usage: issmscpin(host, packages, path) - bracketstyle: 1 - \{\} (escaped; default) + bracketstyle: 1 - \\{\\} (escaped; default) 2 - {} (not escaped) """ @@ -28,9 +28,9 @@ def issmscpin(host, login, port, path, packages=1): if len(packages) == 1: fileliststr = packages[0] else: - fileliststr = '\{' + fileliststr = r'\{' fileliststr += ','.join([package for package in packages]) - fileliststr += '\}' + fileliststr += r'\}' # Remove backslashes if bracketstyle is 2 if bracketstyle == 2: diff --git a/src/m/os/issmscpout.py b/src/m/os/issmscpout.py index 16420fea4..53bf37591 100644 --- a/src/m/os/issmscpout.py +++ b/src/m/os/issmscpout.py @@ -9,7 +9,7 @@ def issmscpout(host, path, login, port, packages, no_symlinks=0, bracketstyle=1) Usage: issmscpout(host, path, login, port, packages, no_symlinks, bracketstyle) - bracketstyle: 1 - \{\} (escaped; default) + bracketstyle: 1 - \\{\\} (escaped; default) 2 - {} (not escaped) """ @@ -34,9 +34,9 @@ def issmscpout(host, path, login, port, packages, no_symlinks=0, bracketstyle=1) if len(packages) == 1: fileliststr = packages[0] else: - fileliststr = '\{' + fileliststr = r'\{' fileliststr += ','.join([package for package in packages]) - fileliststr += '\}' + fileliststr += r'\}' # Remove backslashes if bracketstyle is 2 if bracketstyle == 2: diff --git a/src/m/parameterization/interpISMIP6AntarcticaOcn.m b/src/m/parameterization/interpISMIP6AntarcticaOcn.m index bf7f8c063..366f5d736 100644 --- a/src/m/parameterization/interpISMIP6AntarcticaOcn.m +++ b/src/m/parameterization/interpISMIP6AntarcticaOcn.m @@ -1,4 +1,4 @@ -function basalforcings = interpISMIP6AntarcticaOcn(md,model_name) +function basalforcings = interpISMIP6AntarcticaOcn(md, model_name, start_end) %interpISMIP6AntarcticaOcn - interpolate chosen ISMIP6 atmospheric forcing to model % % Input: @@ -18,6 +18,7 @@ % miroc-esm-chem_rcp8.5 % noresm1-m_rcp2.6 noresm1-m_rcp8.5 % ukesm1-0-ll_ssp585 +% - start_end (optional int array): two entry array of [start_year end_year] % % Output: % - basalforcings: prepared to be input directly into md.basalforcings @@ -25,6 +26,18 @@ % % Examples: % md.basalforcings = interpISMIP6AntarcticaOcn(md,'miroc-esm-chem_rcp8.5'); +% md.basalforcings = interpISMIP6AntarcticaOcn(md,'miroc-esm-chem_rcp8.5', [2007 2050]); + +% Parse inputs +if nargin<3 + start_time = 1995; + end_time = 2100; +elseif + start_time = start_end(1); + end_time = start_end(2); +else + error('no supported'); +end % Find appropriate directory switch oshostname(), @@ -56,13 +69,15 @@ z_data = double(ncread(tfnc,'z')); %Build tf cell array -time = 1995:2100; +time = start_time:end_time; tf = cell(1,1,size(tf_data,3)); +start_idx = start_time - 1994; +final_idx = end_time - 1994; for i=1:size(tf_data,3) %Iterate over depths disp([' == Interpolating over depth ' num2str(i) '/' num2str(size(tf_data,3))]); temp_matrix=[]; - for ii=1:size(tf_data,4) %Iterate over time steps + for ii=start_idx:final_idx %Iterate over time steps %temp_tfdata=InterpFromGridToMesh(x_n,y_n,tf_data(:,:,i,ii)',md.mesh.x,md.mesh.y,0); temp_tfdata=InterpFromGrid(x_n,y_n,tf_data(:,:,i,ii)',md.mesh.x,md.mesh.y); temp_matrix = [temp_matrix temp_tfdata]; @@ -79,7 +94,7 @@ disp(' == Interpolating basin Id'); num_basins = length(unique(basinid_data)); -deltat_median = NaN(length(unique(basinid_data)),1); +deltat_median = NaN(1,length(unique(basinid_data))); for i=0:num_basins-1 pos = find(basinid_data==i); @@ -102,4 +117,4 @@ basalforcings.gamma_0 = gamma0_median; basalforcings.tf = tf; -disp('Info: forcings cover 1995 to 2100'); +disp(['Info: forcings cover ' num2str(start_time),' to ', num2str(end_time)]); diff --git a/src/m/parameterization/interpISMIP6AntarcticaOcn.py b/src/m/parameterization/interpISMIP6AntarcticaOcn.py new file mode 100644 index 000000000..44d6866b7 --- /dev/null +++ b/src/m/parameterization/interpISMIP6AntarcticaOcn.py @@ -0,0 +1,258 @@ + +import os, re, glob +import numpy as np +from pathlib import Path +from netCDF4 import Dataset +from typing import Optional, Tuple, List + +# Optional ISSM helpers +try: + from InterpFromGridToMesh import InterpFromGridToMesh as _ISSM_InterpFromGrid +except Exception: + _ISSM_InterpFromGrid = None + +try: + from basalforcingsismip6 import basalforcingsismip6 as _BasalForcingsISSM6 +except Exception: + _BasalForcingISSM6 = None + +# Fallback interpolator +from scipy.interpolate import griddata as _griddata + +def _decimal_year(year, month, day=15): + return float(year) + (float(month) - 0.5) / 12.0 +def _hostname_based_basepath() -> str: + """Replicates your MATLAB switch on hostname; raise if unknown.""" + host = os.uname().nodename + if host == "totten": + return "/totten_1/ModelData/ISMIP6/Projections/AIS/Ocean_Forcing/" + elif host == "amundsen.thayer.dartmouth.edu": + return "/local/ModelData/ISMIP6Data/Forcings2100/Ocean/" + elif host == "nri-085597": + return "/Users/u7322062/Documents/ISSM/examples/mismip_reduced/DATA/ISMIP6/Ocean_Forcing/" + raise RuntimeError(f"Machine '{host}' not supported yet; please provide your own path") + + +def _interp2d( + xaxis: np.ndarray, + yaxis: np.ndarray, + field2d: np.ndarray, + xq: np.ndarray, + yq: np.ndarray, +) -> np.ndarray: + """ + Interpolate rectilinear grid -> scattered points. + + xaxis (nx,), yaxis (ny,), field2d (ny, nx) + """ + if _ISSM_InterpFromGrid is not None: + # ISSM version (fast) + # MATLAB used field' when calling, so transpose here as well. + return _ISSM_InterpFromGrid(xaxis, yaxis, field2d.T, xq, yq, 0) + + # SciPy fallback (slower, but OK since we only do Nz interpolations) + X, Y = np.meshgrid(xaxis, yaxis) # (ny, nx) + pts = np.c_[X.ravel(), Y.ravel()] + vals = field2d.ravel() + + out = _griddata(pts, vals, np.c_[xq, yq], method="linear") + if np.isnan(out).any(): + out_near = _griddata(pts, vals, np.c_[xq, yq], method="nearest") + out = np.where(np.isnan(out), out_near, out) + return out + + +def _months_1995_2014() -> List[Tuple[int, int]]: + months: List[Tuple[int, int]] = [] + for y in range(1995, 2015): # inclusive 1995–2014 + for m in range(1, 13): + months.append((y, m)) + return months # length 240 + +from model import * +# --------- main function --------- +def interpISMIP6AntarcticaOcn( + md: Optional[object] = None, + model_name: str = "", + root: Optional[str] = None, + filename: str = "obs_thermal_forcing_1995-2017_8km_x_60m.nc", +): + """ + Load observational TF from a single 3-D file thermal_forcing(z,y,x), + build a monthly time axis 1995–2014, and replicate the 3-D field + for each month (constant in time). + + Returns an object suitable for md.basalforcings (basalforcingsismip6). + """ + class _BF(object): + """Dummy basalforcings object for when basalforcingsismip6 Python wrapper + is not available. Must expose a 'checkconsistency' attribute so that + loadvars/ismodelselfconsistent don't crash. + """ + def __init__(self): + # Simple no-op consistency check + def _checkconsistency(md, solution, analyses): + return + self.checkconsistency = _checkconsistency + # --- Case 1: called by loadmodel with no args --------------------------- + # --- Called by loadmodel/loadvars with no args --------------------------- + if md is None: + if _BasalForcingsISSM6 is not None: + return _BasalForcingsISSM6() + else: + return _BF() # <-- important + + + + + # ----- locate file ----- + base = _hostname_based_basepath() if root is None else root + candidate_paths = [ + Path(base) / model_name / "1995-2017" / filename, + Path(base) / model_name / "1995-2100" / filename, + Path(base) / model_name / filename, + Path(filename), + ] + ncpath = next((p for p in candidate_paths if p.exists()), None) + if ncpath is None: + raise FileNotFoundError(f"Could not find {filename} under {base}/{model_name}") + + ncpath = str(ncpath) + + # ----- read axes + 3D TF (no time) ----- + with Dataset(ncpath, "r") as nc: + x_n = np.array(nc.variables["x"][:], dtype=float) + y_n = np.array(nc.variables["y"][:], dtype=float) + z_data = np.array(nc.variables["z"][:], dtype=float) + tf3d = np.array(nc.variables["thermal_forcing"][:], dtype=float) # (z,y,x) + + Nz, Ny, Nx = tf3d.shape + + # ----- build time: monthly 1995–2014 ----- + months = _months_1995_2014() + Nt = len(months) # 240 + + # ----- build time: ONLY ONE TIME since field is constant ----- + # pick an arbitrary reference time, e.g. mid-1995 + time = np.array([_decimal_year(1995, 7)], dtype=float) # shape (1,) + + Nnode = md.mesh.numberofvertices + tf: List[np.ndarray] = [None] * Nz + + print( + f" == Interpolating observational TF (constant in time): " + f"Nz={Nz}, Nt={time.size}, nodes={Nnode}" + ) + + # ----- interpolate per depth ----- + for iz in range(Nz): + print(f" == Interpolating over depth {iz+1}/{Nz}") + Fyx = tf3d[iz, :, :] # (y,x) + + # Interpolate ONCE at this depth + vals = _interp2d(x_n, y_n, Fyx, md.mesh.x, md.mesh.y).astype(np.float32) # (Nnode,) + + # Single time slice: (Nnode, 1) + temp_matrix = vals.reshape(-1, 1) + + # Append a single time row at bottom: (Nnode+1, 1) + tf_depth = np.vstack([temp_matrix, time.reshape(1, -1)]) # (Nnode+1, 1) + tf[iz] = tf_depth + + # time = np.array([_decimal_year(y, m) for (y, m) in months], dtype=float) + + # Nnode = md.mesh.numberofvertices + # tf: List[np.ndarray] = [None] * Nz + + # print( + # f" == Interpolating observational TF (constant in time) 1995–2014: " + # f"Nz={Nz}, Nt={Nt}, nodes={Nnode}" + # ) + + # # ----- interpolate per depth ----- + # for iz in range(Nz): + # print(f" == Interpolating over depth {iz+1}/{Nz}") + # Fyx = tf3d[iz, :, :] # (y,x) + + # # Interpolate ONCE at this depth (field is time-invariant) + # vals = _interp2d(x_n, y_n, Fyx, md.mesh.x, md.mesh.y) # (Nnode,) + + # # Replicate this column for all months: (Nnode, Nt) + # temp_matrix = np.tile(vals.reshape(-1, 1), (1, Nt)) + + # # Append time row at bottom, like MATLAB [values ; time] + # tf_depth = np.vstack([temp_matrix, time.reshape(1, -1)]) + # tf[iz] = tf_depth + + # ---------- Basin / ΔT / γ0 handling (same as before) ---------- + path = _hostname_based_basepath() if root is None else root + deltatnc_median = str( + Path(path) + / "parameterizations" + / "coeff_gamma0_DeltaT_quadratic_non_local_median.nc" + ) + basin_datanc = str(Path(path) / "imbie2" / "imbie2_basin_numbers_8km.nc") + + with Dataset(deltatnc_median, "r") as nc: + deltaT_median = np.array(nc["deltaT_basin"][:], dtype=float) + gamma0_median = np.array(nc["gamma0"][:], dtype=float) + with Dataset(basin_datanc, "r") as nc: + basinid_grid = np.array(nc["basinNumber"][:], dtype=float) + + unique_ids = np.unique(basinid_grid[~np.isnan(basinid_grid)]).astype(int) + num_basins = unique_ids.size + deltat_median = np.empty(num_basins, dtype=float) + for i, bid in enumerate(unique_ids): + vals = deltaT_median[basinid_grid == bid] + deltat_median[i] = vals.flat[0] if vals.size else np.nan + + # element-center basin id (handle 0- vs 1-based elements) + if getattr(md.mesh, "elements", None) is None: + raise RuntimeError("md.mesh.elements is required to compute basin IDs") + + one_based = np.min(md.mesh.elements) == 1 + elems = md.mesh.elements - 1 if one_based else md.mesh.elements + x_el = np.mean(md.mesh.x[elems], axis=1) + y_el = np.mean(md.mesh.y[elems], axis=1) + + # ensure basin grid shape matches (ny,nx) + if basinid_grid.shape == (Ny, Nx): + basin_yx = basinid_grid + elif basinid_grid.shape == (Nx, Ny): + basin_yx = basinid_grid.T + else: + raise RuntimeError("Unexpected basin grid shape vs (ny,nx) from obs TF file") + + Xg, Yg = np.meshgrid(x_n, y_n) + b_near = _griddata( + np.c_[Xg.ravel(), Yg.ravel()], + basin_yx.ravel(), + np.c_[x_el, y_el], + method="nearest", + ) + basinid = b_near.astype(int) + 1 # +1 to match MATLAB behavior + + # # ----- pack basalforcings object ----- + # if _BasalForcingsISSM6 is not None: + # # If md already has basalforcings, copy generic fields, otherwise new + # if getattr(md, "basalforcings", None) is not None: + # bf = _BasalForcingsISSM6(md.basalforcings) + # else: + # bf = _BasalForcingsISSM6() + # else: + # bf = _BF() # <-- use dummy with checkconsistency + bf = md.basalforcings + + bf.basin_id = basinid + bf.num_basins = int(num_basins) + bf.delta_t = deltat_median + bf.tf_depths = z_data.astype(float) + bf.gamma_0 = gamma0_median.astype(float) + bf.tf = tf + + + print( + f"Info: observational TF assumed constant in time; " + f"monthly forcings constructed for 1995–2014 (Nt={Nt}) from {Path(ncpath).name}" + ) + return md diff --git a/src/m/plot/latlongrid.m b/src/m/plot/latlongrid.m new file mode 100644 index 000000000..dae972167 --- /dev/null +++ b/src/m/plot/latlongrid.m @@ -0,0 +1,192 @@ +function latlongrid(varargin) +%LATLONGRID - make lat lon grid on figure +% +% Usage: +% latlongrid(varargin) +% +% Supported options: +% - 'linecolor': line color (default is [0 0 0]) +% - 'latlonres': lat/lon resolution (default is 0.01 deg) +% - 'sgn': 1 : north latitude (default is mer=45 lat=70) +% -1 : south latitude (default is mer=0 lat=71) +% - 'lat': series of latitude to display +% - 'lon': series of longitude to display + +%process options +options = pairoptions(varargin{:}); +linecolor = getfieldvalue(options,'linecolor',[0 0 0]); +latlonres = getfieldvalue(options,'latlonres',0.01); +sgn = getfieldvalue(options,'sgn', 1); + +%Some parameters +numpts = 1000; + +%Get plot extrema +XLIM=xlim(); YLIM=ylim(); +xmin = XLIM(1); xmax = XLIM(2); +ymin = YLIM(1); ymax = YLIM(2); + +%Get lat/lon "extremes" (warning: they may be INSIDE the plot, which is why we use meshgrid) +[allX allY] = meshgrid(linspace(xmin,xmax,numpts),linspace(ymin,ymax,numpts)); +if sgn == 1 + disp('== Northern hemisphere ==') + delta = 45; + slat = 70; +else + delta = 0; + slat = 71; + disp('== Southern hemisphere ==') +end +[alllat alllon] = xy2ll(allX(:),allY(:),sgn,delta,slat); + +%Get lat list (easy) +latmin = min(alllat); latmax = max(alllat); +latrange = latmax - latmin; +dlat = dtick(latrange); +latlist = (dlat*ceil(latmin/dlat)):dlat:latmax; +latlist_long = latmin:latlonres:latmax; + +%Get lon list (hard because it jumps from -180 to 180) +sortedlons = sort(alllon); +pos = find(diff(sortedlons)>10); +if isempty(pos) + lonmin = min(alllon); lonmax = max(alllon); + lonrange = lonmax-lonmin; + dlon = dtick(lonrange); + lonlist = [(dlon*ceil(lonmin/dlon)):dlon:lonmax]; + lonlist_long = lonmin:latlonres:lonmax; +else + assert(numel(pos)==1); + lonmin1 = sortedlons(1); lonmax1 = sortedlons(pos); + lonmin2 = sortedlons(pos+1); lonmax2 = 180;%sortedlons(end); + lonrange = lonmax1-lonmin1 + lonmax2-lonmin2; + dlon = dtick(lonrange); + lonlist = [(dlon*ceil(lonmin2/dlon)):dlon:lonmax2 (dlon*ceil(lonmin1/dlon)):dlon:lonmax1]; + lonlist_long = [lonmin2:latlonres:lonmax2 lonmin1:latlonres:lonmax1]; +end + +%Overwrite if need be +if exist(options,'lat'); latlist = getfieldvalue(options,'lat'); end +if exist(options,'lon'); lonlist = getfieldvalue(options,'lon'); end + +%draw lats and lon +hold on +tic +for thislat=latlist + lon=lonlist_long; + lat=thislat*ones(size(lon)); + [xll,yll]=ll2xy(lat,lon,sgn,delta,slat); + pos = find(xll>xmin & xllymin & yllxmax | yllymax); + xll(pos) = NaN; + yll(pos) = NaN; + p=plot(xll,yll);set(p,'Color',linecolor,'LineWidth',1,'LineStyle','-') +% uistack(p, 'bottom') +end +for thislon=lonlist + lat=latlist_long; + lon=thislon*ones(size(lat)); + [xll,yll]=ll2xy(lat,lon,sgn,delta,slat); + pos = find(xll>xmin & xllymin & yllxmax | yllymax); + xll(pos) = NaN; + yll(pos) = NaN; + p=plot(xll,yll);set(p,'Color',linecolor,'LineWidth',1,'LineStyle','-') +% uistack(p, 'bottom') +end + +%Now change axis ticks Let's assume we have lat on x axis, but that may change... +ax = gca; + +%x-axis compute how many ticks we would have it we display longitude +[xlat xlon] = xy2ll(linspace(xmin,xmax,numpts),linspace(ymin,ymin,numpts),sgn,delta,slat); +sortedlons = sort(xlon); +pos = find(diff(sortedlons)>10); +if isempty(pos) + lonmin = min(xlon); lonmax = max(xlon); + lontick = lonlist(find(lonlist>lonmin & lonlistlonmin1 & lonlistlonmin2 & lonlistlatmin & latlist numel(lattick) + %x-axis -> lonngitude + xtick = interp1(xlon,linspace(xmin,xmax,numpts),lontick,'linear','extrap'); + labels = compose(['%g' char(176) 'E'],lontick); + pos = find(lontick<0); + labels(pos) = compose(['%g' char(176) 'W'],abs(lontick(pos))); + if numel(xtick)>1 & xtick(2)-xtick(1)<0 + xtick = fliplr(xtick); + labels = fliplr(labels); + end + ax.XTick = xtick; + ax.XTickLabel = labels; + + %y-axis -> latitude + [ylat ylon] = xy2ll(linspace(xmin,xmin,numpts),linspace(ymin,ymax,numpts),sgn,delta,slat); + latmin = min(ylat); latmax = max(ylat); + lonmin = min(ylon); lonmax = max(ylon); + lattick = latlist(find(latlist>latmin & latlist latitude + lattick = latlist(find(latlist>latmin & latlist longitude + [ylat ylon] = xy2ll(linspace(xmin,xmin,numpts),linspace(ymin,ymax,numpts),sgn,delta,slat); + latmin = min(ylat); latmax = max(ylat); + lonmin = min(ylon); lonmax = max(ylon); + lontick = lonlist(find(lonlist>lonmin & lonlist Skipping ', recordName]); + end + + %Change class depending on what's provided + if strcmp(recordName, 'md.mesh.elementtype') + switch(data) + case 'Tria'; md.mesh = mesh2d(); + case 'Penta'; md.mesh = mesh3dprisms(); + otherwise error(['Element type ', data, ' not supported yet']); + end + end + end + fclose(fid); +end + +function fmt = CodeToFormat(code) % {{{ + switch code + case 1, fmt = 'Boolean'; + case 2, fmt = 'Integer'; + case 3, fmt = 'Double'; + case 4, fmt = 'String'; + case 5, fmt = 'BooleanMat'; + case 6, fmt = 'IntMat'; + case 7, fmt = 'DoubleMat'; + case 8, fmt = 'MatArray'; + case 9, fmt = 'StringArray'; + otherwise, error('Unsupported code: %d', code); + end +end % }}} +function code=FormatToCode(format) % {{{ + %This routine takes the format string, and hardcodes it into an integer, which + %is passed along the record, in order to identify the nature of the dataset being + %sent. + if strcmpi(format,'Boolean'), + code=1; + elseif strcmpi(format,'Integer'), + code=2; + elseif strcmpi(format,'Double'), + code=3; + elseif strcmpi(format,'String'), + code=4; + elseif strcmpi(format,'BooleanMat'), + code=5; + elseif strcmpi(format,'IntMat'), + code=6; + elseif strcmpi(format,'DoubleMat'), + code=7; + elseif strcmpi(format,'MatArray'), + code=8; + elseif strcmpi(format,'StringArray'), + code=9; + elseif strcmpi(format,'CompressedMat'), + code=10; + else + error('FormatToCode error message: data type not supported yet!'); + end +end% }}} diff --git a/src/m/solve/WriteData.m b/src/m/solve/WriteData.m index 43c1ebf8c..e68a6648e 100644 --- a/src/m/solve/WriteData.m +++ b/src/m/solve/WriteData.m @@ -95,7 +95,7 @@ function WriteData(fid,prefix,varargin) if(numel(data)~=1), error(['field ' name ' cannot be marshalled as it has more than one element!']); end %first write length of record - fwrite(fid,8+4,'int64'); %1 double+code + fwrite(fid,4+8,'int64'); %1 double+code %write data code: fwrite(fid,FormatToCode(format),'int'); diff --git a/src/m/solve/marshall.m b/src/m/solve/marshall.m index 045d14be3..d8dc842b2 100644 --- a/src/m/solve/marshall.m +++ b/src/m/solve/marshall.m @@ -7,19 +7,19 @@ function marshall(md) % Usage: % marshall(md) -if md.verbose.solution, +if md.verbose.solution disp(['marshalling file ' md.miscellaneous.name '.bin']); end %open file for binary writing fid=fopen([ md.miscellaneous.name '.bin'],'wb'); -if fid==-1, +if fid==-1 error(['marshall error message: could not open ' [md.miscellaneous.name '.bin'],' file for binary writing']); end % Go through all model fields: check that it is a class and call checkconsistency fields=sort(properties('model')); %sort fields so that comparison of binary files is easier -for i=1:length(fields), +for i=1:length(fields) field=fields{i}; %Some properties do not need to be marshalled diff --git a/src/m/solve/solve.m b/src/m/solve/solve.m index 6d9083484..cc0a58b3a 100644 --- a/src/m/solve/solve.m +++ b/src/m/solve/solve.m @@ -97,7 +97,7 @@ if md.verbose.solution, disp('checking model consistency'); end - ismodelselfconsistent(md), + ismodelselfconsistent(md); end %If we are restarting, actually use the provided runtime name: @@ -146,15 +146,17 @@ end if isempty(restart), + disp('uploading input files') UploadQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist); end %launch queue job: +disp('launching solution sequence') LaunchQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist,restart,batch); %return if batch: -if batch, - if md.verbose.solution, +if batch + if md.verbose.solution disp('batch mode requested: not launching job interactively'); disp('launch solution sequence on remote cluster by hand'); end diff --git a/src/m/solve/solve.py b/src/m/solve/solve.py index 05094cf3d..8e937573a 100644 --- a/src/m/solve/solve.py +++ b/src/m/solve/solve.py @@ -143,9 +143,11 @@ def solve(md, solutionstring, *args): filelist.append(modelname + '.qmu.in') if isempty(restart): + print('uploading input files') cluster.UploadQueueJob(md.miscellaneous.name, md.private.runtimename, filelist) # Launch job + print('launching solution sequence') cluster.LaunchQueueJob(md.miscellaneous.name, md.private.runtimename, filelist, restart, batch) # Return if batch diff --git a/src/m/solve/solveiceocean.m b/src/m/solve/solveiceocean.m index cafcf94f6..34991f13d 100644 --- a/src/m/solve/solveiceocean.m +++ b/src/m/solve/solveiceocean.m @@ -41,12 +41,12 @@ md.private.solution=solutionstring; cluster=md.cluster; if strcmpi(getfieldvalue(options,'batch','no'),'yes') batch=1; else batch=0; end -if ~isa(cluster,'localpfe') & ~isa(cluster,'generic'), +if ~isa(cluster,'localpfe') & ~isa(cluster,'generic') error('cannot run ice/ocean simulation on any other cluster than localpfe'); end %check model consistency -if strcmpi(getfieldvalue(options,'checkconsistency','yes'),'yes'), +if strcmpi(getfieldvalue(options,'checkconsistency','yes'),'yes') if md.verbose.solution, disp('checking model consistency'); end @@ -59,9 +59,9 @@ if restart==1 %Leave the runtimename as is else - if ~isempty(restart), + if ~isempty(restart) md.private.runtimename=restart; - elseif getfieldvalue(options,'runtimename',true), + elseif getfieldvalue(options,'runtimename',true) c=clock; md.private.runtimename=sprintf('%s-%02i-%02i-%04i-%02i-%02i-%02i-%i',md.miscellaneous.name,c(2),c(3),c(1),c(4),c(5),floor(c(6)),feature('GetPid')); else @@ -71,7 +71,7 @@ %if running qmu analysis, some preprocessing of dakota files using models %fields needs to be carried out. -if md.qmu.isdakota, +if md.qmu.isdakota md=preqmu(md,options); end @@ -89,7 +89,7 @@ %Upload all required files modelname = md.miscellaneous.name; filelist = {[modelname '.bin'] [modelname '.toolkits']}; -if ispc, +if ispc filelist{end+1}=[modelname '.bat']; else filelist{end+1}=[modelname '.queue']; @@ -99,11 +99,12 @@ filelist{end+1} = [modelname '.qmu.in']; end -if isempty(restart), +if isempty(restart) UploadQueueJob(cluster,md.miscellaneous.name,md.private.runtimename,filelist); end %launch queue job: +disp('launching solution sequence') LaunchQueueJobIceOcean(cluster,md.miscellaneous.name,md.private.runtimename,filelist,restart,batch); %return if batch: @@ -115,7 +116,7 @@ return; end %wait on lock -if isnan(md.settings.waitonlock), +if isnan(md.settings.waitonlock) %load when user enters 'y' disp('solution launched on remote cluster. log in to detect job completion.'); choice=input('Is the job successfully completed? (y/n)','s'); @@ -124,13 +125,13 @@ else md=loadresultsfromcluster(md); end -elseif md.settings.waitonlock>0, +elseif md.settings.waitonlock>0 %we wait for the done file done=waitonlock(md); if md.verbose.solution, disp('loading results from cluster'); end md=loadresultsfromcluster(md,'runtimename',''); -elseif md.settings.waitonlock==0, +elseif md.settings.waitonlock==0 disp('Model results must be loaded manually with md=loadresultsfromcluster(md);'); end diff --git a/src/m/solve/solveslm.m b/src/m/solve/solveslm.m index bb1a0c627..b14e27533 100644 --- a/src/m/solve/solveslm.m +++ b/src/m/solve/solveslm.m @@ -74,6 +74,7 @@ UploadQueueJob(cluster,slm.miscellaneous.name,slm.private.runtimename,filelist); %launch queue job: +disp('launching solution sequence') LaunchQueueJob(cluster,slm.miscellaneous.name,slm.private.runtimename,filelist,'',batch); %wait on lock diff --git a/src/m/solve/solveslm.py b/src/m/solve/solveslm.py index ac856a964..da2b70086 100644 --- a/src/m/solve/solveslm.py +++ b/src/m/solve/solveslm.py @@ -24,9 +24,6 @@ def solveslm(slm, solutionstringi, *args): slm=solveslm(slm,'Transient'); """ - print('Yep') - exit() - # Recover and process solve options if solutionstringi.lower() == 'tr' or solutionstringi.lower() == 'transient': solutionstring = 'TransientSolution' @@ -50,7 +47,7 @@ def solveslm(slm, solutionstringi, *args): totalnp = totalnp + slm.icecaps[i].cluster.np totalnp = totalnp + slm.earth.cluster.np if totalnp != slm.cluster.np: - raise RuntimeError('sum of all icecaps and earch cluster processors requestes should be equal to slm.cluster.np') + raise RuntimeError('sum of all icecaps and earth cluster processors requests should be equal to slm.cluster.np') # Recover some fields slm.private.solution = solutionstring @@ -83,6 +80,7 @@ def solveslm(slm, solutionstringi, *args): UploadQueueJob(cluster, slm.miscellaneous.name, slm.private.runtimename, filelist) # Launch queue job + print('launching solution sequence') LaunchQueueJob(cluster, slm.miscellaneous.name, slm.private.runtimename, filelist, '', batch) # Wait on lock diff --git a/src/wrappers/Scotch/Scotch.cpp b/src/wrappers/Scotch/Scotch.cpp deleted file mode 100644 index faf5a282b..000000000 --- a/src/wrappers/Scotch/Scotch.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/*\file Scotch.c - *\brief: Scotch partitioner mex module - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif -#include "./Scotch.h" - -void GmapUsage(void){/*{{{*/ - mexPrintf("\n"); - mexPrintf("Usage: [maptab]=Scotch(adjmat,vertlb,vertwt,edgewt,archtyp,archpar,\n"); - mexPrintf(" Scotch-specific parameters);\n"); - mexPrintf("\n"); -}/*}}}*/ -void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){ - - #ifndef _HAVE_SCOTCH_ //only works if scotch library has been compiled in. - _error_("Scotch not available! Cannot carry out Scotch partitioning!"); - #else - - int argcm; - char **argvm=NULL; - int nvert =0,nedge2=0,napar =0; - mwIndex *ir=NULL,*jc=NULL; - int *adjir=NULL,*adjjc=NULL; - double *vld=NULL,*vwd=NULL,*ewd=NULL,*apd=NULL; - int *vli=NULL,*vwi=NULL,*ewi=NULL,*api=NULL; - char *archtyp=NULL; - int (*maptabi)[2]=NULL; - double* maptabd=NULL; - int i,j,k,imi=0,imo=0,isi=0,ierr; - - /* Check for proper number of arguments */ - - if (nrhs == 0 && nlhs == 0) { - GmapUsage(); - return; - } - else if (nrhs < 6 || nlhs > 1) { - GmapUsage(); - mexErrMsgTxt(" "); - } - -/* load matlab argument list and convert to integer (note that converting here - and in the x-layer is inefficient, but it makes the x-layer more general) */ - - argvm = (char **) calloc(nrhs,sizeof(char *)); - - if (!(mxIsNumeric(prhs[imi]) && - (mxGetM(prhs[imi]) == 1 && mxGetN(prhs[imi]) == 1))) { - argvm[isi] = (char *) calloc(4+1,sizeof(char)); - strcpy(argvm[isi],"gmap"); - mexPrintf("%s -- Using \"%s\" entry point.\n", - __FUNCT__,argvm[isi]); - isi++; - } - else { - argvm[isi] = (char *) calloc(5+1,sizeof(char)); - strcpy(argvm[isi],"gpart"); - mexPrintf("%s -- Using \"%s\" entry point.\n", - __FUNCT__,argvm[isi]); - isi++; - - argvm[isi] = (char *) calloc(17,sizeof(char)); - sprintf(argvm[isi],"%d",(int)mxGetScalar(prhs[imi])); - mexPrintf("%s -- Number of parts is %s.\n", - __FUNCT__,argvm[isi]); - isi++; - imi++; - } - - if (!mxIsNumeric(prhs[imi]) || (!mxIsEmpty(prhs[imi]) && !mxIsSparse(prhs[imi]))) { - mexPrintf("%s -- Adjacency matrix must be numeric and sparse.\n",__FUNCT__); - mexErrMsgTxt(" "); - } - else { - nvert =mxGetM(prhs[imi]); - nedge2=mxGetNzmax(prhs[imi]); - if (mxGetNzmax(prhs[imi])) { - ir =mxGetIr(prhs[imi]); - adjir = (int *) malloc(mxGetNzmax(prhs[imi])*sizeof(int)); - for (i=0; i= 5) && - (strncmp (argvm[0] + strlen (argvm[0]) - 5, "gpart", 5) == 0))) { - if (!mxIsChar(prhs[imi])) { - mexPrintf("%s -- Architecture type must be character.\n",__FUNCT__); - mexErrMsgTxt(" "); - } - else { - if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) { - archtyp = (char *) calloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])+1,sizeof(char)); - mxGetString(prhs[imi],archtyp,mxGetM(prhs[imi])*mxGetN(prhs[imi])+1); - } - mexPrintf("%s -- Architecture type is \"%s\".\n", - __FUNCT__,archtyp); - } - imi++; - - if (!mxIsNumeric(prhs[imi])) { - mexPrintf("%s -- Architecture parameter vector must be numeric.\n",__FUNCT__); - mexErrMsgTxt(" "); - } - else { - napar =mxGetM(prhs[imi])*mxGetN(prhs[imi]); - if (mxGetM(prhs[imi])*mxGetN(prhs[imi])) { - apd=mxGetPr(prhs[imi]); - api = (int *) malloc(mxGetM(prhs[imi])*mxGetN(prhs[imi])*sizeof(int)); - for (i=0; i=0; i--) - free(argvm[i]); - if (api) free(api); - if (archtyp) free(archtyp); - if (ewi) free(ewi); - if (vwi) free(vwi); - if (vli) free(vli); - if (adjjc) free(adjjc); - if (adjir) free(adjir);*/ - - return; -#endif //#ifndef _HAVE_SCOTCH_ -} diff --git a/src/wrappers/Scotch/Scotch.h b/src/wrappers/Scotch/Scotch.h deleted file mode 100644 index ca0275e41..000000000 --- a/src/wrappers/Scotch/Scotch.h +++ /dev/null @@ -1,34 +0,0 @@ -/*!\file: Scotch.h - * \brief header file for Scotch module. - */ - -#ifndef _SCOTCH_H -#define _SCOTCH_H - -#include "../bindings.h" /*Should always come first to avoid python's warnings*/ -#include -#include /* strcasecmp */ -#include /* clock,time,difftime */ -#include "../../c/main/globals.h" -#include "../../c/modules/modules.h" -#include "../../c/shared/shared.h" - -#undef __FUNCT__ -#define __FUNCT__ "Scotch" - -/* Scotch structures and prototypes */ -#ifdef MATLAB -#include "mat.h" -#include "mex.h" -#include "matrix.h" - -#define printf mexPrintf -#define fprintf(file,...) (file == stdout || file == stderr ? mexPrintf(__VA_ARGS__) : fprintf(file,__VA_ARGS__)) -#define malloc mxMalloc -#define calloc mxCalloc -#define realloc mxRealloc -#define free mxFree -#define exit(status) mexErrMsgTxt("exit=" #status) -#endif - -#endif /* _SCOTCH_H */ diff --git a/src/wrappers/ShpRead/ShpRead.cpp b/src/wrappers/ShpRead/ShpRead.cpp deleted file mode 100644 index e8c76f19f..000000000 --- a/src/wrappers/ShpRead/ShpRead.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/*\file ShpRead.c - *\brief: shp to exp file conversion mex module. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#else -#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -#include "./ShpRead.h" -#ifdef _HAVE_SHAPELIB_ //only works if Shapelib library has been compiled in. -#include "shapefil.h" -#endif - -void ShpReadUsage(void){/*{{{*/ - _printf0_("ShpRead - Read shapefile\n"); - _printf0_("\n"); - _printf0_(" This module reads shapefiles and converts them to matlab/python structures\n"); - _printf0_("\n"); - _printf0_(" Usage:\n"); - _printf0_(" ShpRead(filename);\n"); - _printf0_(" filexp file name of exp file to be written\n"); - _printf0_("\n"); - _printf0_(" Examples:\n"); - _printf0_(" ShpRead('file.shp');\n"); -}/*}}}*/ -WRAPPER(ShpRead_python){ - - /*input: */ - char *filename= NULL; - - /*Boot module: */ - MODULEBOOT(); - - #ifndef _HAVE_SHAPELIB_ //only works if shapelib library has been compiled in. - _error_("Shapelib not available! Cannot carry out shp file translation!"); - #else - - /*checks on arguments on the matlab side: */ - if(nlhs != NLHS){ShpReadUsage(); _error_("ShpRead usage error");} - if(nrhs != NRHS){ShpReadUsage(); _error_("ShpRead usage error");} - - /*Input datasets: */ - FetchData(&filename,SHP_IN); - - /*Open shapefile*/ - SHPHandle hSHP = SHPOpen( filename, "rb" ); - if(!hSHP) _error_("Error opening shp/shx files."); - - /*read header and print out file bounds*/ - int nShapeType,nEntities; - IssmPDouble adfMinBound[4], adfMaxBound[4]; - SHPGetInfo( hSHP, &nEntities, &nShapeType, adfMinBound, adfMaxBound ); - _printf_("Shapefile Type: "<nSHPType)<<") nVertices="<nVertices<<", nParts="<nParts<<"\n"); - - Contour *contour = NULL; - - switch(psShape->nSHPType){ - case SHPT_POINTZ: - contour=new Contour(0,psShape->nVertices,psShape->padfX,psShape->padfY,false); - break; - case SHPT_ARC: - contour=new Contour(0,psShape->nVertices,psShape->padfX,psShape->padfY,false); - break; - default: - _printf_("Shape type "<nSHPType)<<" not supported yet, skipping...\n"); - } - - /*Add to contours and clean up*/ - if(contour) contours->AddObject(contour); - SHPDestroyObject(psShape); - } - - /*Write output*/ - WriteData(SHP_OUT,contours); - - /*Clean-up*/ - delete contours; - xDelete(filename); - - #endif - /*end module: */ - MODULEEND(); -} diff --git a/src/wrappers/ShpRead/ShpRead.h b/src/wrappers/ShpRead/ShpRead.h deleted file mode 100644 index 1548fcc79..000000000 --- a/src/wrappers/ShpRead/ShpRead.h +++ /dev/null @@ -1,47 +0,0 @@ -/*!\file ShpRead.h - * \brief: prototype for shp read mex module. - */ - -#ifndef _SHPREAD_H -#define _SHPREAD_H - -#ifdef HAVE_CONFIG_H - #include -#else - #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" -#endif - -/*For python modules: needs to come before header files inclusion*/ -#ifdef _HAVE_PYTHON_ -#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol -#endif - -#include "../bindings.h" -#include "../../c/main/globals.h" -#include "../../c/modules/modules.h" -#include "../../c/shared/shared.h" - -#undef __FUNCT__ -#define __FUNCT__ "ShpRead" - -#ifdef _HAVE_MATLAB_MODULES_ -/* serial input macros: */ -#define SHP_IN prhs[0] -/* serial output macros: */ -#define SHP_OUT (mxArray**)&plhs[0] -#endif - -#ifdef _HAVE_PYTHON_MODULES_ -/* serial input macros: */ -#define SHP_IN PyTuple_GetItem(args,0) -/* serial output macros: */ -#define SHP_OUT output,0 -#endif - -/* serial arg counts: */ -#undef NRHS -#define NRHS 1 -#undef NLHS -#define NLHS 1 - -#endif diff --git a/src/wrappers/javascript/Makefile.am b/src/wrappers/javascript/Makefile.am index 6c9fd786b..d35024708 100644 --- a/src/wrappers/javascript/Makefile.am +++ b/src/wrappers/javascript/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = @DAKOTAINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @PARMETISINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @AMPIINCL@ @CODIPACKINCL@ +AM_CPPFLAGS = @DAKOTAINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @PARMETISINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @AMPIINCL@ @CODIPACKINCL@ AUTOMAKE_OPTIONS = subdir-objects EXEEXT=$(JAVASCRIPTWRAPPEREXT) @@ -77,7 +77,7 @@ if !MSYS2 libISSMJavascript_la_LDFLAGS += -static libISSMApi_javascript_la_LDFLAGS += -static endif -deps += $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(NEOPZLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(PROJLIB) $(OSLIBS) +deps += $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(MKLLIB) $(MPILIB) $(NEOPZLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(PROJLIB) $(OSLIBS) endif libISSMApi_javascript_la_LIBADD = $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(PROJLIB) $(MATHLIB) diff --git a/src/wrappers/matlab/Makefile.am b/src/wrappers/matlab/Makefile.am index 484e27362..7a7a57ed4 100644 --- a/src/wrappers/matlab/Makefile.am +++ b/src/wrappers/matlab/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @BOOSTINCL@ @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @PARMETISINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @AMPIINCL@ @MEDIPACKINCL@ @ADJOINTPETSCINCL@ @CODIPACKINCL@ @PROJINCL@ +AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @BOOSTINCL@ @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @PARMETISINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @AMPIINCL@ @MEDIPACKINCL@ @ADJOINTPETSCINCL@ @CODIPACKINCL@ @PROJINCL@ AUTOMAKE_OPTIONS = subdir-objects EXEEXT=$(MATLABWRAPPEREXT) @@ -60,7 +60,6 @@ lib_LTLIBRARIES += \ PointCloudFindNeighbors_matlab.la \ ProcessRifts_matlab.la \ PropagateFlagsFromConnectivity_matlab.la \ - Scotch_matlab.la \ Triangle_matlab.la if CHACO @@ -72,9 +71,6 @@ endif if PROJ lib_LTLIBRARIES += CoordTransform_matlab.la endif -if SHP -lib_LTLIBRARIES += ShpRead_matlab.la -endif #}}} # Dependencies {{{ @@ -178,7 +174,7 @@ if !MSYS2 libISSMMatlab_la_LDFLAGS += -static libISSMApi_matlab_la_LDFLAGS += -static endif -deps += $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(NEOPZLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(OSLIBS) ${LIBADD_FOR_MEX} +deps += $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(MKLLIB) $(MPILIB) $(NEOPZLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(OSLIBS) ${LIBADD_FOR_MEX} endif libISSMApi_matlab_la_LIBADD = $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(MATHLIB) $(MEXLIB) @@ -284,14 +280,6 @@ PropagateFlagsFromConnectivity_matlab_la_SOURCES = ../PropagateFlagsFromConnecti PropagateFlagsFromConnectivity_matlab_la_CXXFLAGS = ${AM_CXXFLAGS} PropagateFlagsFromConnectivity_matlab_la_LIBADD = ${deps} -Scotch_matlab_la_SOURCES = ../Scotch/Scotch.cpp -Scotch_matlab_la_CXXFLAGS = ${AM_CXXFLAGS} -Scotch_matlab_la_LIBADD = ${deps} - -ShpRead_matlab_la_SOURCES = ../ShpRead/ShpRead.cpp -ShpRead_matlab_la_CXXFLAGS = ${AM_CXXFLAGS} -ShpRead_matlab_la_LIBADD = ${deps} $(SHAPELIBLIB) - Triangle_matlab_la_SOURCES = ../Triangle/Triangle.cpp Triangle_matlab_la_CXXFLAGS = ${AM_CXXFLAGS} Triangle_matlab_la_LIBADD = ${deps} $(TRIANGLELIB) diff --git a/src/wrappers/python/Makefile.am b/src/wrappers/python/Makefile.am index 915c61c25..a68663dcc 100644 --- a/src/wrappers/python/Makefile.am +++ b/src/wrappers/python/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @PARMETISINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @AMPIINCL@ @MEDIPACKINCL@ @ADJOINTPETSCINCL@ @CODIPACKINCL@ @PROJINCL@ +AM_CPPFLAGS = @NEOPZINCL@ @DAKOTAINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@ @PETSCINCL@ @MPIINCL@ @SPOOLESINCL@ @PARMETISINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @AMPIINCL@ @MEDIPACKINCL@ @ADJOINTPETSCINCL@ @CODIPACKINCL@ @PROJINCL@ AUTOMAKE_OPTIONS = subdir-objects #define prefix (from http://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Defining-Directories.html) @@ -157,7 +157,7 @@ if !MSYS2 libISSMPython_la_LDFLAGS = -static libISSMApi_python_la_LDFLAGS = -static endif -deps += $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(SCOTCHLIB) $(MKLLIB) $(MPILIB) $(NEOPZLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(OSLIBS) $(PYTHONLIB) +deps += $(DAKOTALIB) $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(TAOLIB) $(M1QN3LIB) $(SEMICLIB) $(PLAPACKLIB) $(SUPERLULIB) $(SPOOLESLIB) $(TRIANGLELIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(MKLLIB) $(MPILIB) $(NEOPZLIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(GSLLIB) $(ADOLCLIB) $(AMPILIB) $(OSLIBS) $(PYTHONLIB) endif libISSMApi_python_la_LIBADD = $(PETSCLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLASLAPACKLIB) $(PARMETISLIB) $(METISLIB) $(HDF5LIB) $(MPILIB) $(NEOPZLIB) $(GSLLIB) $(MATHLIB) diff --git a/test/Archives/Archive306.arch b/test/Archives/Archive306.arch index 470ce5809..526089427 100644 Binary files a/test/Archives/Archive306.arch and b/test/Archives/Archive306.arch differ diff --git a/test/Archives/Archive502.arch b/test/Archives/Archive502.arch index f4dcc4de3..0cd7f09fd 100644 Binary files a/test/Archives/Archive502.arch and b/test/Archives/Archive502.arch differ diff --git a/test/Archives/Archive503.arch b/test/Archives/Archive503.arch index 8722cf2f1..412692572 100644 Binary files a/test/Archives/Archive503.arch and b/test/Archives/Archive503.arch differ diff --git a/test/Archives/Archive512.arch b/test/Archives/Archive512.arch index 45aee526c..f2e283b6f 100644 Binary files a/test/Archives/Archive512.arch and b/test/Archives/Archive512.arch differ diff --git a/test/Archives/Archive550.arch b/test/Archives/Archive550.arch new file mode 100644 index 000000000..457fe52cb Binary files /dev/null and b/test/Archives/Archive550.arch differ diff --git a/test/NightlyRun/runme.m b/test/NightlyRun/runme.m index e09c6604c..8a68da75c 100755 --- a/test/NightlyRun/runme.m +++ b/test/NightlyRun/runme.m @@ -38,8 +38,8 @@ % Examples: % runme; % runme('exclude',101); -% runme('id',102,'procedure','update'); -% runme('procedure','valgrind','stoponerror',1,'exclude','IdFromString('Dak')); +% runme('id', 102, 'procedure', 'update'); +% runme('procedure', 'valgrind', 'stoponerror', 1, 'exclude', IdFromString('Dak')); % % NOTE: % - Will only run test scripts whose names explicitly follow the convention, diff --git a/test/NightlyRun/test3015.py b/test/NightlyRun/test3015.py index de50acadf..c72cae5a3 100644 --- a/test/NightlyRun/test3015.py +++ b/test/NightlyRun/test3015.py @@ -69,7 +69,7 @@ V2 = md.results.MasstransportSolution.IceVolume #compute resulting derivative -dVdh_an = (V2 - V0) / deltaH +dVdh_an = ((V2 - V0) / deltaH)[0] #evaluate derivative using ADOLC md = md2 @@ -81,7 +81,7 @@ md = solve(md, 'Masstransport') #retrieve directly -dVdh_ad = md.results.MasstransportSolution.AutodiffJacobian +dVdh_ad = md.results.MasstransportSolution.AutodiffJacobian[0][0] print("dV / dh: analytical: %16.16g\n using adolc: %16.16g\n" % (dVdh_an, dVdh_ad)) diff --git a/test/NightlyRun/test306.m b/test/NightlyRun/test306.m index b3b0de16e..3d7485396 100644 --- a/test/NightlyRun/test306.m +++ b/test/NightlyRun/test306.m @@ -2,7 +2,7 @@ md=triangle(model(),'../Exp/Square.exp',180000.); md=setmask(md,'',''); md=parameterize(md,'../Par/SquareSheetConstrained.par'); -md=extrude(md,4,2.); +md=extrude(md,3,1.); md=setflowequation(md,'SIA','../Exp/SquareHalfRight.exp','fill','SSA'); md.cluster=generic('name',oshostname(),'np',3); md=solve(md,'Stressbalance'); diff --git a/test/NightlyRun/test306.py b/test/NightlyRun/test306.py index d1c5da2da..16800c199 100644 --- a/test/NightlyRun/test306.py +++ b/test/NightlyRun/test306.py @@ -11,7 +11,7 @@ md = triangle(model(), '../Exp/Square.exp', 180000.) md = setmask(md, '', '') md = parameterize(md, '../Par/SquareSheetConstrained.py') -md.extrude(4, 2.) +md.extrude(3, 1.) md = setflowequation(md, 'SIA', '../Exp/SquareHalfRight.exp', 'fill', 'SSA') md.cluster = generic('name', gethostname(), 'np', 3) md = solve(md, 'Stressbalance') diff --git a/test/NightlyRun/test502.m b/test/NightlyRun/test502.m index ce176122e..98dcb9dad 100644 --- a/test/NightlyRun/test502.m +++ b/test/NightlyRun/test502.m @@ -2,7 +2,7 @@ md=triangle(model(),'../Exp/Pig.exp',20000.); md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp'); md=parameterize(md,'../Par/Pig.par'); -md=extrude(md,3,0.9); +md=extrude(md,4,0.9); md=setflowequation(md,'HO','all'); md.cluster=generic('name',oshostname(),'np',3); md=solve(md,'Stressbalance'); diff --git a/test/NightlyRun/test502.py b/test/NightlyRun/test502.py index 21a74afd0..28a44e939 100644 --- a/test/NightlyRun/test502.py +++ b/test/NightlyRun/test502.py @@ -11,7 +11,7 @@ md = triangle(model(), '../Exp/Pig.exp', 20000.) md = setmask(md, '../Exp/PigShelves.exp', '../Exp/PigIslands.exp') md = parameterize(md, '../Par/Pig.py') -md.extrude(3, 0.9) +md.extrude(4, 0.9) md = setflowequation(md, 'HO', 'all') md.cluster = generic('name', gethostname(), 'np', 3) md = solve(md, 'Stressbalance') diff --git a/test/NightlyRun/test503.m b/test/NightlyRun/test503.m index fe45525df..fef957b7b 100644 --- a/test/NightlyRun/test503.m +++ b/test/NightlyRun/test503.m @@ -2,7 +2,7 @@ md=triangle(model(),'../Exp/Pig.exp',20000.); md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp'); md=parameterize(md,'../Par/Pig.par'); -md=extrude(md,3,0.9); +md=extrude(md,4,0.9); md=setflowequation(md,'FS','all'); md.cluster=generic('name',oshostname(),'np',3); md=solve(md,'Stressbalance'); diff --git a/test/NightlyRun/test503.py b/test/NightlyRun/test503.py index fb0b30251..4baab9a1f 100644 --- a/test/NightlyRun/test503.py +++ b/test/NightlyRun/test503.py @@ -11,7 +11,7 @@ md = triangle(model(), '../Exp/Pig.exp', 20000.) md = setmask(md, '../Exp/PigShelves.exp', '../Exp/PigIslands.exp') md = parameterize(md, '../Par/Pig.py') -md.extrude(3, 0.9) +md.extrude(4, 0.9) md = setflowequation(md, 'FS', 'all') md.cluster = generic('name', gethostname(), 'np', 3) md = solve(md, 'Stressbalance') diff --git a/test/NightlyRun/test512.m b/test/NightlyRun/test512.m index 20b3b4b3c..7002d6e0d 100644 --- a/test/NightlyRun/test512.m +++ b/test/NightlyRun/test512.m @@ -2,7 +2,7 @@ md=triangle(model(),'../Exp/Pig.exp',20000.); md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp'); md=parameterize(md,'../Par/Pig.par'); -md=extrude(md,3,1.); +md=extrude(md,4,1.); md=setflowequation(md,'HO','all'); %control parameters diff --git a/test/NightlyRun/test512.py b/test/NightlyRun/test512.py index 2149ac787..3fa235305 100644 --- a/test/NightlyRun/test512.py +++ b/test/NightlyRun/test512.py @@ -12,7 +12,7 @@ md = triangle(model(), '../Exp/Pig.exp', 20000.) md = setmask(md, '../Exp/PigShelves.exp', '../Exp/PigIslands.exp') md = parameterize(md, '../Par/Pig.py') -md.extrude(3, 1.) +md.extrude(4, 1.) md = setflowequation(md, 'HO', 'all') # control parameters diff --git a/test/NightlyRun/test550.m b/test/NightlyRun/test550.m new file mode 100644 index 000000000..8f14b809d --- /dev/null +++ b/test/NightlyRun/test550.m @@ -0,0 +1,63 @@ +%Test Name: PigShakti +md=triangle(model(),'../Exp/Pig.exp',1000.); +md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp'); +md=parameterize(md,'../Par/Pig.par'); +md=setflowequation(md,'SSA','all'); +md.timestepping.start_time = 0; +md.timestepping.time_step = 1*3600/md.constants.yts;; +md.timestepping.final_time = 1/24/365; + +% Turn on SHAKTI and turn off other transient processes for now +md.transient=deactivateall(md.transient); +md.transient.isstressbalance=0; % Solve for ice velocity 1, turn off 0 +md.transient.ishydrology=1; + +% HYDROLOGY SPECIFIC PARAMETERIZATION: +% Change hydrology class to SHAKTI model +md.hydrology=hydrologyshakti(); + +% Define distributed englacial input to the subglacial system (m/yr) +md.hydrology.englacial_input = 0.0*ones(md.mesh.numberofvertices,1); + +% Define initial water head such that water pressure is 50% of ice overburden pressure +md.hydrology.head = 0.5*md.materials.rho_ice/md.materials.rho_freshwater*md.geometry.thickness + md.geometry.base; + +% Initial subglacial gap height of 0.001m everywhere +md.hydrology.gap_height = 0.001*ones(md.mesh.numberofelements,1); + +% Typical bed bump bump spacing +md.hydrology.bump_spacing = 1.0*ones(md.mesh.numberofelements,1); + +% Typical bed bump height +md.hydrology.bump_height = 0.0*ones(md.mesh.numberofelements,1); + +% Initial Reynolds number (start at Re=1000 everywhere) +md.hydrology.reynolds= 1000*ones(md.mesh.numberofelements,1); + +% Deal with boundary conditions +md.hydrology.spchead = NaN(md.mesh.numberofvertices,1); +md.hydrology.spchead(md.mask.ocean_levelset<=0)=0; + +md.hydrology.moulin_input = zeros(md.mesh.numberofvertices,1); +md.hydrology.neumannflux=zeros(md.mesh.numberofelements,1); + +% Friction +Neff = md.materials.rho_ice*md.constants.g*md.geometry.thickness-md.materials.rho_water*md.constants.g*(md.hydrology.head - md.geometry.base); +md.friction.effective_pressure=Neff; +md.friction.effective_pressure_limit(:)=0; +md.friction.coupling = 4; + +md.cluster=generic('name',oshostname(),'np',8); +md=solve(md,'Transient'); + +%Fields and tolerances to track changes +field_names ={... + 'HydrologyHead1','HydrologyGapHeight1','EffectivePressure1'}; +field_tolerances={... + 1e-13, 1e-13,... + 1e-13}; +field_values={... + md.results.TransientSolution(1).HydrologyHead, ... + md.results.TransientSolution(1).HydrologyGapHeight,... + md.results.TransientSolution(1).EffectivePressure}; + diff --git a/test/NightlyRun/test803.m b/test/NightlyRun/test803.m index 1d77c2482..b933baad5 100644 --- a/test/NightlyRun/test803.m +++ b/test/NightlyRun/test803.m @@ -30,7 +30,7 @@ field_tolerances={... 2e-12,2e-12,2e-12,3e-13,3e-13,2e-13,2e-13,1e-13,1e-13,... 4e-12,6e-12,4e-12,3e-13,8e-13,2e-13,2e-13,1e-13,1e-13,... - 6e-12,2e-11,6e-12,8e-13,9e-13,3e-13,2e-13,1e-13,1e-13,... + 6e-12,2e-11,6e-12,8e-13,1e-12,4e-13,2e-13,1e-13,1e-13,... }; field_values={... md.results.TransientSolution(1).Vx,... diff --git a/test/NightlyRun/test803.py b/test/NightlyRun/test803.py index 18e5913bf..70a89ed71 100644 --- a/test/NightlyRun/test803.py +++ b/test/NightlyRun/test803.py @@ -38,7 +38,7 @@ 'Vx3', 'Vy3', 'Vel3', 'Pressure3', 'Thickness3', 'Surface3', 'MaskIceLevelset3', 'Enthalpy3', 'Watercolumn3'] field_tolerances = [2e-12, 2e-12, 2e-12, 3e-13, 3e-13, 2e-13, 2e-13, 1e-13, 1e-13, 4e-12, 6e-12, 4e-12, 3e-13, 8e-13, 2e-13, 2e-13, 1e-13, 1e-13, - 6e-12, 2e-11, 6e-12, 8e-13, 9e-13, 3e-13, 2e-13, 1e-13, 1e-13] + 6e-12, 2e-11, 6e-12, 8e-13, 1e-12, 4e-13, 2e-13, 1e-13, 1e-13] field_values = [md.results.TransientSolution[0].Vx, md.results.TransientSolution[0].Vy, md.results.TransientSolution[0].Vel,