Hello,
I installed PyFR following this page ,ubuntu (Installation — Documentation)
I am tyring test cases on wrb site(Examples — Documentation). I could make one partation, however I have gotten error mesages. Could you tell me how to fix it? My cuda version is 12.0 and pyhon is 3.10.6.
I attach the error mesages.
Best,
Yuji
Did you add anything to the ini file regarding the cuda backend? For example:
[backend-cuda]
device-id = local-rank
Also when you run nvidia-smi
do you see the GPU?
Thank you for replying.
Yes, I can watch GPU.
I did not add anything into the ini file. Where should I write?
[backend]
precision = double
[constants]
nu = 0.005
Uin = 1.0
Vin = 0.0
Pc = 1.0
ac-zeta = 2.5
[solver]
system = ac-navier-stokes
order = 3
[solver-time-integrator]
formulation = dual
scheme = sdirk33
pseudo-scheme = rk45
controller = none
pseudo-controller = local-pi
tstart = 0.0
tend = 75.0
dt = 0.05
pseudo-dt = 0.005
pseudo-niters-min = 3
pseudo-niters-max = 3
pseudo-resid-norm = l2
pseudo-resid-tol = 1e-12
atol = 1e-6
pseudo-dt-max-mult = 2.5
[solver-dual-time-integrator-multip]
pseudo-dt-fact = 1.75
cycle = [(3, 1), (2, 1), (1, 1), (0, 2), (1, 1), (2, 1), (3, 4)]
[solver-interfaces]
riemann-solver = rusanov
ldg-beta = 0.5
ldg-tau = 0.1
[solver-interfaces-line]
flux-pts = gauss-legendre
[solver-elements-tri]
soln-pts = williams-shunn
[solver-elements-quad]
soln-pts = gauss-legendre
[soln-plugin-nancheck]
nsteps = 50
[soln-plugin-pseudostats]
flushsteps = 20
file = residual.csv
header = true
[soln-plugin-writer]
dt-out = 5.0
basedir = .
basename = inc-cylinder-{t:.2f}
[soln-bcs-wall]
type = no-slp-wall
[soln-bcs-inlet]
type = ac-char-riem-inv
ac-zeta = 180
p = Pc
u = Uin
v = Vin
[soln-bcs-outlet]
type = ac-char-riem-inv
ac-zeta = 180
p = Pc
u = Uin
v = Vin
[soln-ics]
u = Uin
v = Vin
p = Pc
You can add it anywhere just not in the middle of some other seciton, the parser will find it. Under the hood this is what is being used: configparser — Configuration file parser — Python 3.11.2 documentation
When you updated cuda did you correctly update the library paths?
Yes, I think I updated the library paths crrectly.
Do you think that paths in my attached fig are correcte?
I tried a sample code of Nvidia.
I could calculate it.
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size);
__global__ void addKernel(int *c, const int *a, const int *b)
{
int i = threadIdx.x;
c[i] = a[i] + b[i];
}
int main()
{
const int arraySize = 5;
const int a[arraySize] = { 1, 2, 3, 4, 5 };
const int b[arraySize] = { 10, 20, 30, 40, 50 };
int c[arraySize] = { 0 };
// Add vectors in parallel.
cudaError_t cudaStatus = addWithCuda(c, a, b, arraySize);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "addWithCuda failed!");
return 1;
}
printf("{1,2,3,4,5} + {10,20,30,40,50} = {%d,%d,%d,%d,%d}\n",
c[0], c[1], c[2], c[3], c[4]);
// cudaDeviceReset must be called before exiting in order for profiling and
// tracing tools such as Nsight and Visual Profiler to show complete traces.
cudaStatus = cudaDeviceReset();
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaDeviceReset failed!");
return 1;
}
return 0;
}
// Helper function for using CUDA to add vectors in parallel.
cudaError_t addWithCuda(int *c, const int *a, const int *b, unsigned int size)
{
int *dev_a = 0;
int *dev_b = 0;
int *dev_c = 0;
cudaError_t cudaStatus;
// Choose which GPU to run on, change this on a multi-GPU system.
cudaStatus = cudaSetDevice(0);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaSetDevice failed! Do you have a CUDA-capable GPU installed?");
goto Error;
}
// Allocate GPU buffers for three vectors (two input, one output) .
cudaStatus = cudaMalloc((void**)&dev_c, size * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc failed!");
goto Error;
}
cudaStatus = cudaMalloc((void**)&dev_a, size * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc failed!");
goto Error;
}
cudaStatus = cudaMalloc((void**)&dev_b, size * sizeof(int));
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMalloc failed!");
goto Error;
}
// Copy input vectors from host memory to GPU buffers.
cudaStatus = cudaMemcpy(dev_a, a, size * sizeof(int), cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMemcpy failed!");
goto Error;
}
cudaStatus = cudaMemcpy(dev_b, b, size * sizeof(int), cudaMemcpyHostToDevice);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMemcpy failed!");
goto Error;
}
// Launch a kernel on the GPU with one thread for each element.
addKernel<<<1, size>>>(dev_c, dev_a, dev_b);
// Check for any errors launching the kernel
cudaStatus = cudaGetLastError();
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
goto Error;
}
// cudaDeviceSynchronize waits for the kernel to finish, and returns
// any errors encountered during the launch.
cudaStatus = cudaDeviceSynchronize();
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaDeviceSynchronize returned error code %d after launching addKernel!\n", cudaStatus);
goto Error;
}
// Copy output vector from GPU buffer to host memory.
cudaStatus = cudaMemcpy(c, dev_c, size * sizeof(int), cudaMemcpyDeviceToHost);
if (cudaStatus != cudaSuccess) {
fprintf(stderr, "cudaMemcpy failed!");
goto Error;
}
Error:
cudaFree(dev_c);
cudaFree(dev_a);
cudaFree(dev_b);
return cudaStatus;
}
There might be something else in the software stack that is compiled against the old version of cuda. Have you recompiled everything against this new version of cuda that might be using it?
Thank you for your replyig.
I will fresh my wsl ubuntu and reinstall.
Be sure to follow the CUDA on WSL install guide to the letter. Otherwise, it is easy to end up with two copies of libcuda.so
and one of them will be broken.
Regards, Freddie.
Dear Dr. Will , Prof Freddie,
Thank you for your replyng. I am done with calculating the test case on WSL with CUDA12.1
I leave notes for anybady who has as same errors as I got on WSL with CUDA 12.1.
- Installing the GPU driver in Windows automatically puts the driver in the WSL as well.
- When installing CUDA, WSL-Ubuntu distribution should be choosen; https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=WSL-Ubuntu&target_version=2.0&target_type=deb_local
- After installed CUDA 12.1, make symbolic link of CUDA precompile file
(shared object) in /usr/lib/wsl/lib into /usr/lib/x86_64-linux-gnu
For example, wsl@username:/usr/lib/x86_64-linux-gnu$ sudo ln -s /usr/lib/wsl/lib/* ./
Best
Yuji
Continuing the discussion from Error: CUDANoDevice on WSL:
Hi Yuji,
I’m trying to run the example files for the first time, and I encountered the exact same traceback for error as you (finishing with line 33). So I found this thread, and tried the symbolic link thing you kindly noted, but it keeps failing.
I’m now using CUDA 11.8 on WSL, but it would be helpful if I can get some more detailed explanation or link you refered to.
Thank you, June.
Hi june,
Could you check the symbolic link in “/usr/lib/x86_64-linux-gnu” and give me a picture ?
And aldo Could you give me the picture in " /usr/lib/wsl/lib/"?
Dear Yuji,
Thank you for your kind reply.
List of symbolic link in “/usr/lib/x86_64-linux-gnu” is too long to take picture or copy text. Please let me know if there is specific link to check.
Picture in " /usr/lib/wsl/lib/" is:
And when I try “wsl@username:/usr/lib/x86_64-linux-gnu$ sudo ln -s /usr/lib/wsl/lib/* ./”, I get:
ln: failed to create symbolic link './libcuda.so': File exists
ln: failed to create symbolic link './libcuda.so.1': File exists
ln: failed to create symbolic link './libcuda.so.1.1': File exists
ln: failed to create symbolic link './libcudadebugger.so.1': File exists
ln: failed to create symbolic link './libd3d12.so': File exists
ln: failed to create symbolic link './libd3d12core.so': File exists
ln: failed to create symbolic link './libdxcore.so': File exists
ln: failed to create symbolic link './libnvcuvid.so': File exists
ln: failed to create symbolic link './libnvcuvid.so.1': File exists
ln: failed to create symbolic link './libnvdxdlkernels.so': File exists
ln: failed to create symbolic link './libnvidia-encode.so': File exists
ln: failed to create symbolic link './libnvidia-encode.so.1': File exists
ln: failed to create symbolic link './libnvidia-ml.so.1': File exists
ln: failed to create symbolic link './libnvidia-opticalflow.so': File exists
ln: failed to create symbolic link './libnvidia-opticalflow.so.1': File exists
ln: failed to create symbolic link './libnvoptix.so.1': File exists
ln: failed to create symbolic link './libnvoptix_loader.so.1': File exists
ln: failed to create symbolic link './libnvwgf2umx.so': File exists
ln: failed to create symbolic link './nvidia-smi': File exists
Best regards, June
Dear June,
Ok,
When you made symbolic link, was your directory at “/usr/lib/x86_64-linux-gnu”?
Could you try these commands?
$cd /usr/lib/x86_64-linux-gnu
$sudo ln -s /usr/lib/wsl/lib/* ./
This is because you need to make symbolic link in /usr/lib/x86_64-linux-gnu
Yuji
I originally tried at the directory “/usr/lib/x86_64-linux-gnu” and got the error of above, but now I fixed.
In case someone got error
ln: failed to create symbolic link '***' : File exists
like me, try
ln -sf /usr/lib/wsl/lib/* ./
to overwrite symbolic links, instead of
ln -s /usr/lib/wsl/lib/* ./
which Yuji kindly noted above.
Thank you very much Yuji, for your kind response and notes. It really helped me.
Best regards, June
Good! My pleasure! Were you able to calclate test cases?
Best,
Yuji from Tokyo
Yeah, I calculated examples successfully. Thanks again for your help.
Best regards, June