niessner / Opt

Opt DSL
Other
256 stars 68 forks source link

CUDA 10 got a different path for libdevice #143

Open ProfFan opened 5 years ago

ProfFan commented 5 years ago
./image_warping 
width 512, height 512
numActivePixels: 101406
linkllvm(/usr/local/cuda/nvvm/libdevice/libdevice.compute_30.10.bc): No such file or directory

patch at util.t:

local cuda_compute_version = 30
-- local libdevice = terralib.cudahome..string.format("/nvvm/libdevice/libdevice.compute_%d.10.bc",cuda_compute_version)
local libdevice = terralib.cudahome.."/nvvm/libdevice/libdevice.10.bc"

After it works fine.

gerwang commented 5 years ago

But after modifying util.t, I encountered following error:

warning: Linking two modules of different data layouts: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0/nvvm/libdevice/libdevice.10.bc' is '' whereas 'external' is 'e-m:w-i64:64-f80:128-n8:16:32:64-S128'

Using Opt v0.2.2
nUnknowns =     307200
nResiduals =    0 + 307200 * 6

nnz =   0 + 307200 * 26

'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/util.t:873: cuModuleLoadData: cuda reported error 218: a PTX JIT compilation failed
stack traceback:
        [C]: in function 'error'
        [string "<string>"]:250: in function 'cudacompile'
        C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/util.t:873: in function 'makeGPUFunctions'
        ...ents\git-task\Optlang\Opt\API\src/solverGPUGaussNewton.t:762: in function 'compilePlan'
        C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/o.t:870: in function <C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/o.t:862>
        [C]: in function 'xpcall'
        C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/o.t:862: in function <C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/o.t:861>
warning: Linking two modules of different data layouts: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0/nvvm/libdevice/libdevice.10.bc' is '' whereas 'external' is 'e-m:w-i64:64-f80:128-n8:16:32:64-S128'

I am using CUDA 10.0 on Windows 10 and building the example project shape from shading.

ProfFan commented 5 years ago

Windows 10 is not currently a supported platform for CUDA I think. Also you will need the latest Terra compiled from source.

gerwang commented 5 years ago

I see, I think if I use a CUDA version other than 7.5, I should compile terra from source. But CUDA 10.0 actually supports Windows 10.

ProfFan commented 5 years ago

s/for CUDA/for Terra CUDA support/g :)

gerwang commented 5 years ago

@ProfFan What version of LLVM are you using? I am currently using LLVM 6.0.1 built from source on Windows 10 but still encountering the above errors. I heard that LLVM supports CUDA 10 after version r342924.

gerwang commented 5 years ago

I followed the commit on https://marc.info/?l=llvm-commits&m=153783073315460&w=2 and add some enums to my LLVM 6.0.1 source code. Now it works, but this warning warning: Linking two modules of different data layouts: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0/nvvm/libdevice/libdevice.10.bc' is '' whereas 'external' is 'e-m:w-i64:64-f80:128-n8:16:32:64-S128' still exists.

ProfFan commented 5 years ago

The warning can be safely ignored.

gerwang commented 5 years ago

Please tell me your LLVM version @ProfFan, cause I am still encountering a strange problem with modified LLVM 6.0.1. The shape from shading example compiles and runs, but the OptGN method does not converge and final cost rises to 3000 (initial cost is 128), while OptLM method reverts every iteration.

gerwang commented 5 years ago

I think there are some problems with cuda's math library, maybe just adding new enums to LLVM cannot get it to produce right PTX (CUDA 10 requires PTX 6.3 while LLVM 6.0.1 still generates PTX 6.0).

ProfFan commented 5 years ago

Are you using the latest Terra compiled from source? Mine is CUDA 10 and LLVM 7.

LLVM 5 is super buggy itself and is not recommended even not for Terra. LLVM 6 and 7 should be fine.

ProfFan commented 5 years ago

Also if you are referring to the SfS example, it does not work for me either.

Mx7f commented 5 years ago

I wonder if the SfS example error is related to #136. I will be testing in the coming days.

zhangfqjs commented 5 years ago

But after modifying util.t, I encountered following error:

warning: Linking two modules of different data layouts: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0/nvvm/libdevice/libdevice.10.bc' is '' whereas 'external' is 'e-m:w-i64:64-f80:128-n8:16:32:64-S128'

Using Opt v0.2.2
nUnknowns =     307200
nResiduals =    0 + 307200 * 6

nnz =   0 + 307200 * 26

'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
'sm_75' is not a recognized processor for this target (ignoring processor)
C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/util.t:873: cuModuleLoadData: cuda reported error 218: a PTX JIT compilation failed
stack traceback:
        [C]: in function 'error'
        [string "<string>"]:250: in function 'cudacompile'
        C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/util.t:873: in function 'makeGPUFunctions'
        ...ents\git-task\Optlang\Opt\API\src/solverGPUGaussNewton.t:762: in function 'compilePlan'
        C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/o.t:870: in function <C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/o.t:862>
        [C]: in function 'xpcall'
        C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/o.t:862: in function <C:\Users\BBNC\Documents\git-task\Optlang\Opt\API\src/o.t:861>
warning: Linking two modules of different data layouts: 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0/nvvm/libdevice/libdevice.10.bc' is '' whereas 'external' is 'e-m:w-i64:64-f80:128-n8:16:32:64-S128'

I am using CUDA 10.0 on Windows 10 and building the example project shape from shading.

I got the same error on win10 and CUDA 10.1, have you fixed it and how?