757
回編集
| 32行目: | 32行目: | ||
vtkDataフォルダの中にあるcavity2dvtk.pvdをParaViewで読み込み、計算が実行されていることを確認してください。 | vtkDataフォルダの中にあるcavity2dvtk.pvdをParaViewで読み込み、計算が実行されていることを確認してください。 | ||
== GPUのみで計算実行 == | |||
=== WSL === | |||
==== CUDAのインストール ==== | |||
Windows側でNVIDIAのドライバーを入れておき、nvidia-smiコマンドが実行できることを確認する。 | |||
cudaをインストールする。<ref>https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local</ref><syntaxhighlight lang="bash"> | |||
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin | |||
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 | |||
wget https://developer.download.nvidia.com/compute/cuda/13.2.0/local_installers/cuda-repo-wsl-ubuntu-13-2-local_13.2.0-1_amd64.deb | |||
sudo dpkg -i cuda-repo-wsl-ubuntu-13-2-local_13.2.0-1_amd64.deb | |||
sudo cp /var/cuda-repo-wsl-ubuntu-13-2-local/cuda-*-keyring.gpg /usr/share/keyrings/ | |||
sudo apt-get update | |||
sudo apt-get -y install cuda-toolkit-13-2 | |||
</syntaxhighlight>インストール出来たら環境変数を追加する。<syntaxhighlight lang="bash"> | |||
export PATH=${PATH}:/usr/local/cuda-13.2/bin > ~/.bashrc | |||
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-13.2/lib64 > ~/.bashrc | |||
</syntaxhighlight> | |||
==== OpenLBの再コンパイル ==== | |||
config.mkをconfig/gpu_only.mkを参考に書き換える。 | |||
GPUによってパラメータの変更は必要。 | |||
(RTX2060の場合)<syntaxhighlight lang="makefile"> | |||
# Example build config for OpenLB using CUDA on single GPU systems | |||
# | |||
# Tested using CUDA 11.4 | |||
# | |||
# Usage: | |||
# - Copy this file to OpenLB root as `config.mk` | |||
# - Adjust CUDA_ARCH to match your specifc GPU | |||
# - Run `make clean; make` | |||
# - Switch to example directory, e.g. `examples/laminar/cavity3dBenchmark` | |||
# - Run `make` | |||
# - Start the simulation using `./cavity3d` | |||
CXX := nvcc | |||
CC := nvcc | |||
CXXFLAGS := -O3 | |||
CXXFLAGS += -std=c++20 --forward-unknown-to-host-compiler | |||
PARALLEL_MODE := NONE | |||
PLATFORMS := CPU_SISD GPU_CUDA | |||
# for e.g. RTX 30* (Ampere), see table in `rules.mk` for other options | |||
CUDA_ARCH := 75 | |||
FLOATING_POINT_TYPE := float | |||
USE_EMBEDDED_DEPENDENCIES := ON | |||
</syntaxhighlight>再コンパイルする。<syntaxhighlight lang="bash"> | |||
make clean | |||
make | |||
</syntaxhighlight> | |||
==== ソルバのコンパイル ==== | |||
ソルバも再コンパイルする。<syntaxhighlight lang="bash"> | |||
make clean | |||
make | |||
</syntaxhighlight> | |||
==== 実行 ==== | |||
実行はCPU版と同じ。<syntaxhighlight lang="bash"> | |||
./<solver> | |||
</syntaxhighlight> | |||
----<references /> | ----<references /> | ||