Closed ffbfbfdf closed 5 months ago
A simple example is shown in the image.
Humm strange. What if you make A=rand(5,5,5)?
Same as two-dimensional
Very strange! Can you tell my the cuda version and gpu you are running it on? I am away but I will try to fix this next week.
GPU:NVIDIA Geforce RTX 3060 LapTop Gpu
In other words, can other versions of CUDA and GPU run normally?
@ffbfbfdf no idea, the error is strange, so maybe this information helps me debug. I'll try to debug next week, apologies fornt delay
Hi, @ffbfbfdf , @AnderBiguri In my environment of Python, I could not reproduce.
import numpy as np
import numpy.random
import tigre
import tigre.algorithms as algs
import tigre.utilities.gpu as gpu
import tigre.utilities.im_3d_denoise
listGpuNames = gpu.getGpuNames()
if len(listGpuNames) == 0:
print("Error: No gpu found")
else:
for id in range(len(listGpuNames)):
print("{}: {}".format(id, listGpuNames[id]))
gpuids = gpu.getGpuIds(listGpuNames[0])
print(gpuids)
A=np.random.randn(1, 5, 5).astype(np.float32)
A[A<0]=0
print(f"A = \n{A}")
B=tigre.utilities.im_3d_denoise.im3ddenoise(A, iter=2, gpuids=gpuids)
print(f"B = \n{B}")
Output
0: NVIDIA GeForce GTX 1060 6GB
{'name': 'NVIDIA GeForce GTX 1060 6GB', 'devices': [0]}
A =
[[[0. 0. 0. 0.45640853 0.8639155 ]
[1.1695538 0. 1.1146449 0. 1.1266571 ]
[1.1079429 0. 0.60824865 0. 0. ]
[0.8022037 1.425755 1.6020744 0. 0. ]
[0.7927743 0.9320209 0.4525195 0.8293371 0. ]]]
B =
[[[-0.01066 0. -0.0143195 0.46933416 0.88098335]
[ 1.2127553 -0.02081952 1.170058 -0.02458851 1.170128 ]
[ 1.1404634 -0.02863753 0.6167504 -0.00554393 -0.01026901]
[ 0.80844307 1.473317 1.6670241 -0.0221613 0. ]
[ 0.80587083 0.95015025 0.44248584 0.86300796 -0.00755906]]]
@tsadakane thanks for testing. Indeed, I suspect this may be perhaps from some behaviour of the code that is CUDA version specific, as I can not reproduce either. Which CUDA are you using?
嗨, ,在我的 Python 环境中,我无法重现。
import numpy as np import numpy.random import tigre import tigre.algorithms as algs import tigre.utilities.gpu as gpu import tigre.utilities.im_3d_denoise listGpuNames = gpu.getGpuNames() if len(listGpuNames) == 0: print("Error: No gpu found") else: for id in range(len(listGpuNames)): print("{}: {}".format(id, listGpuNames[id])) gpuids = gpu.getGpuIds(listGpuNames[0]) print(gpuids) A=np.random.randn(1, 5, 5).astype(np.float32) A[A<0]=0 print(f"A = \n{A}") B=tigre.utilities.im_3d_denoise.im3ddenoise(A, iter=2, gpuids=gpuids) print(f"B = \n{B}")
输出
0: NVIDIA GeForce GTX 1060 6GB {'name': 'NVIDIA GeForce GTX 1060 6GB', 'devices': [0]} A = [[[0. 0. 0. 0.45640853 0.8639155 ] [1.1695538 0. 1.1146449 0. 1.1266571 ] [1.1079429 0. 0.60824865 0. 0. ] [0.8022037 1.425755 1.6020744 0. 0. ] [0.7927743 0.9320209 0.4525195 0.8293371 0. ]]] B = [[[-0.01066 0. -0.0143195 0.46933416 0.88098335] [ 1.2127553 -0.02081952 1.170058 -0.02458851 1.170128 ] [ 1.1404634 -0.02863753 0.6167504 -0.00554393 -0.01026901] [ 0.80844307 1.473317 1.6670241 -0.0221613 0. ] [ 0.80587083 0.95015025 0.44248584 0.86300796 -0.00755906]]]
Why are there negative numbers in matrix B?
@ffbfbfdf probably because the parameters of the denoisers are not appropriate for the toy problem set here. However this is not very relevant to the error you are getting, which is that you get NaNs
@tsadakane thanks for testing. Indeed, I suspect this may be perhaps from some behaviour of the code that is CUDA version specific, as I can not reproduce either. Which CUDA are you using?
CUDA 12.2 with VS2022
@ffbfbfdf , @AnderBiguri,
In my environment of Matlab, I could reproduce.
>> A=randn(5,5)
A =
1.0347 0.8884 1.4384 -0.1022 -0.0301
0.7269 -1.1471 0.3252 -0.2414 -0.1649
-0.3034 -1.0689 -0.7549 0.3192 0.6277
0.2939 -0.8095 1.3703 0.3129 1.0933
-0.7873 -2.9443 -1.7115 -0.8649 1.1093
>> A(A<0)=0
A =
1.0347 0.8884 1.4384 0 0
0.7269 0 0.3252 0 0
0 0 0 0.3192 0.6277
0.2939 0 1.3703 0.3129 1.0933
0 0 0 0 1.1093
>> [B]=im3DDenoise(A, 'TV')
B =
5×5 single matrix
NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN
CUDA 12.2, VS2022, Matlab 2022a. Hmm, too many two's
@ffbfbfdf probably because the parameters of the denoisers are not appropriate for the toy problem set here. However this is not very relevant to the error you are getting, which is that you get NaNs
Yes, expecting help for you to rewrite the bug and hope you give a solution
, ,
在我的Matlab环境中,我可以复制。
>> A=randn(5,5) A = 1.0347 0.8884 1.4384 -0.1022 -0.0301 0.7269 -1.1471 0.3252 -0.2414 -0.1649 -0.3034 -1.0689 -0.7549 0.3192 0.6277 0.2939 -0.8095 1.3703 0.3129 1.0933 -0.7873 -2.9443 -1.7115 -0.8649 1.1093 >> A(A<0)=0 A = 1.0347 0.8884 1.4384 0 0 0.7269 0 0.3252 0 0 0 0 0 0.3192 0.6277 0.2939 0 1.3703 0.3129 1.0933 0 0 0 0 1.1093 >> [B]=im3DDenoise(A, 'TV') B = 5×5 single matrix NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
CUDA 12.2、VS2022、Matlab 2022a。嗯,两个太多了
Does this issue occur with the python version of the code?
Is the input 'A' allowed to be a double precision matrix? In python, it was necessary to use 'astype(float)' to run that code.
输入“A”是否允许是双精度矩阵?在python中,必须使用“astype(float)”来运行该代码。
Makes sense, I type in a single precision to get the result, but there is a negative value
@ffbfbfdf the mathematics allow negative values, so there is no issue with that.
So is the issue double vs single? Or cuda 12.2?
I guess teh bug to fix here is that im3Dnoise should cast/error
Hello, author! I'm having the following issue with Tigre:
Specifications