金子邦彦研究室インストールWindows の種々のソフトウェア(インストール)SuiteSparse,Metis のインストール(ソースコードを使用)(Windows 上)

SuiteSparse,Metis のインストール(ソースコードを使用)(Windows 上)

SuiteSparse は,下記の機能を持つソフトウェアである.

UFconfig は,SuiteSparseQR, AMD, COLAMD, CCOLAMD, CHOLMOD, KLU, BTF, LDL, CXSparse, and UMFPACK のビルドに必要.

AMD は,疎行列の並び替えの機能を持ったソフトウェア. これは,Cholesky factorization や, 不完全 LU 分解 (LU factorization) の前処理として行うもの.

インストールでは,次のページに記載の手順を行う.そして,次のページで公開のプログラム等を使用している.

https://github.com/jlblancoc/suitesparse-metis-for-windows

【目次】

  1. 前準備
  2. SuiteSparse,Metis のインストール(ソースコードを使用)(Windows 上)

SuiteSparse,Metis のインストール(vcpkg を利用)(Windows 上)

  1. Git のインストール

    Windows での Git のインストール: 別ページ »で説明している.

  2. Build Tools for Visual Studio 2022 (ビルドツール for Visual Studio 2022)のインストール

    Windows での Build Tools for Visual Studio 2022 (ビルドツール for Visual Studio 2022) のインストール: 別ページ »で説明している.

  3. vckpg のインストール

    Windows で,コマンドプロンプト管理者として実行.

    次のコマンドを実行

    if not exist c:\vcpkg (
      cd c:\
      rmdir /s /q vcpkg
      git clone https://github.com/microsoft/vcpkg
      cd c:\vcpkg
      git pull
      .\bootstrap-vcpkg.bat
      .\vcpkg update
      .\vcpkg integrate install  
      powershell -command "[System.Environment]::SetEnvironmentVariable(\"VCPKG_ROOT\", \"c:\vcpkg\", \"Machine\")"
      powershell -command "[System.Environment]::SetEnvironmentVariable(\"VCPKG_DEFAULT_TRIPLET\", \"x64-windows\", \"Machine\")"
      powershell -command "[System.Environment]::SetEnvironmentVariable(\"CMAKE_TOOLCHAIN_FILE\", \"c:/vcpkg/scripts/buildsystems/vcpkg.cmake\", \"Machine\")"
      powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"LIB\", \"Machine\"); $oldpath += \";c:\vcpkg\installed\x64-windows\lib\"; [System.Environment]::SetEnvironmentVariable(\"LIB\", $oldpath, \"Machine\")"
      powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"INCLUDE\", \"Machine\"); $oldpath += \";c:\vcpkg\installed\x64-windows\include\"; [System.Environment]::SetEnvironmentVariable(\"INCLUDE\", $oldpath, \"Machine\")"
      powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\vcpkg\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
      powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";c:\vcpkg\installed\x64-windows\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    )
    
  4. SuiteSparse のインストール

    次のコマンドを実行

    c:\vcpkg\vcpkg search suitesparse
    c:\vcpkg\vcpkg install --triplet x64-windows suitesparse
    powershell -command "[System.Environment]::SetEnvironmentVariable(\"SP_ROOT\", \"C:\vcpkg\installed\x64-windows\", \"Machine\")"
    powershell -command "[System.Environment]::SetEnvironmentVariable(\"SUITESPARSE_ROOT\", \"C:\vcpkg\installed\x64-windows\", \"Machine\")"
    
  5. Metis のインストール

    次のコマンドを実行

    c:\vcpkg\vcpkg search metis
    c:\vcpkg\vcpkg install --triplet x64-windows metis
    powershell -command "[System.Environment]::SetEnvironmentVariable(\"METIS_ROOT\", \"C:\vcpkg\installed\x64-windows\", \"Machine\")"
    

1. 前準備

Git のインストール(Windows 上)

Gitは,バージョン管理システム.ソースコードの管理や複数人での共同に役立つ.

サイト内の関連ページ

Windows での Git のインストール: 別ページ »で説明している.

関連する外部ページ

Git の公式ページ: https://git-scm.com/

CMake のインストール(Windows 上)

CMake はビルドツールである.

サイト内の関連ページ

Windows での cmake のインストール: 別ページ »で説明している.

関連する外部ページ

CMake の公式ダウンロードページ: https://cmake.org/download/

Build Tools for Visual Studio 2022 (ビルドツール for Visual Studio 2022),Visual Studio 2022 のインストール(Windows 上)

サイト内の関連ページ

関連する外部ページ

SuiteSparse,Metis のインストール(ソースコードを使用)(Windows 上)

次のページに記載の手順を行う.

https://github.com/jlblancoc/suitesparse-metis-for-windows

前もって,SuiteSparse, Metis をインストールするディレクトリを決めておく

このページでは,いずれも,c:\suitesparse 下にインストールするものとして説明する.

  1. Windows で,コマンドプロンプト管理者として実行.

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  2. SuiteSparse の作業ディレクトリを削除する(以前作業したときのものが残っていたら削除したいため)
    c:
    cd c:\
    rmdir /s /q suitesparse-metis-for-windows
    

    [image]
  3. ソースコードをダウンロード,環境変数 SP_ROOTにダウンロードしたディレクトリを設定
    cd c:\
    git clone --recursive https://github.com/jlblancoc/suitesparse-metis-for-windows
    powershell -command "[System.Environment]::SetEnvironmentVariable(\"SP_ROOT\", \"c:\suitesparse-metis-for-windows\", \"Machine\")"
    

    [image]
  4. cmake の実行

    cmake でのオプションについて

    cmake のオプションの 「Visual Studio 17 2022」のところは, 使用する Visual Studio のバージョンにあわせること. Visual Studio 2022 のときは,「Visual Studio 17 2022」. Visual Studio 2019 のときは,「Visual Studio 16 2019

    cmake の実行手順例は次の通り

    cd c:\
    cd suitesparse-metis-for-windows
    rmdir /s /q build
    mkdir build
    cd build
    del CMakeCache.txt
    cmake .. -G "Visual Studio 17 2022" -A x64 -T host=x64 ^
        -DCMAKE_BUILD_TYPE=Release ^
        -DBUILD_SHARED_LIBS=ON ^
         -DCMAKE_INSTALL_PREFIX="C:/suitesparse" 
    

    [image]
  5. 実行結果の確認

    エラーメッセージが出ていないこと.

    [image]
  6. インストールの実行
    cmake --build. --config RELEASE
    cmake --build. --config RELEASE --target INSTALL
    
  7. 実行結果の確認

    [image]
  8. Windowsシステム環境変数 Pathに,次を追加することにより,パスを通す

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

    次のコマンドを実行

    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\suitesparse\lib\lapack_blas_windows\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\suitesparse\lib\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    powershell -command "$oldpath = [System.Environment]::GetEnvironmentVariable(\"Path\", \"Machine\"); $oldpath += \";C:\suitesparse\bin\"; [System.Environment]::SetEnvironmentVariable(\"Path\", $oldpath, \"Machine\")"
    

    [image]
  9. Windowsシステム環境変数 SUITESPARSE_ROOT に,c:\suitesparse を設定

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

    次のコマンドを実行

    powershell -command "[System.Environment]::SetEnvironmentVariable(\"SUITESPARSE_ROOT\", \"c:\suitesparse\", \"Machine\")"
    

    [image]
  10. Windowsシステム環境変数 METIS_ROOT に,c:\suitesparse を設定

    Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

    次のコマンドを実行

    powershell -command "[System.Environment]::SetEnvironmentVariable(\"METIS_ROOT\", \"c:\suitesparse\", \"Machine\")"
    

    [image]