Project

General

Profile

Bug #11908

Cant activate OpenCL in Windows

Added by Eniz Ka 10 months ago. Updated 9 months ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
01/03/2018
Due date:
% Done:

0%

Affected Version:
2.4.0
System:
Windows
bitness:
64-bit
hardware architecture:
amd64/x86

Description

C:\Program Files\darktable\bin>darktable-cltest.exe
[opencl_init] opencl related configuration options:
[opencl_init]
[opencl_init] opencl: 1
[opencl_init] opencl_library: ''
[opencl_init] opencl_memory_requirement: 768
[opencl_init] opencl_memory_headroom: 300
[opencl_init] opencl_device_priority: '*/!0,*/*/*'
[opencl_init] opencl_mandatory_timeout: 200
[opencl_init] opencl_size_roundup: 16
[opencl_init] opencl_async_pixelpipe: 0
[opencl_init] opencl_synch_cache: 0
[opencl_init] opencl_number_event_handles: 25
[opencl_init] opencl_micro_nap: 1000
[opencl_init] opencl_use_pinned_memory: 0
[opencl_init] opencl_use_cpu_devices: 0
[opencl_init] opencl_avoid_atomics: 0
[opencl_init]
[opencl_init] found opencl runtime library 'OpenCL.dll'
[opencl_init] opencl library 'OpenCL.dll' found on your system and loaded
[opencl_init] found 2 platforms
[opencl_init] found 3 devices
[opencl_init] discarding CPU device 0 ` Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz'.
[opencl_init] device 1 `Intel(R) HD Graphics 4000' supports image sizes of 16384 x 16384
[opencl_init] device 1 `Intel(R) HD Graphics 4000' allows GPU memory allocations of up to 350MB
[opencl_init] device 1: Intel(R) HD Graphics 4000
GLOBAL_MEM_SIZE: 1400MB
MAX_WORK_GROUP_SIZE: 512
MAX_WORK_ITEM_DIMENSIONS: 3
MAX_WORK_ITEM_SIZES: [ 512 512 512 ]
DRIVER_VERSION: 10.18.10.4358
DEVICE_VERSION: OpenCL 1.2
[opencl_init] compiling program `demosaic_ppg.cl' ..
[opencl_fopen_stat] could not open file `C:\Users\EK\AppData\Local\Microsoft\Windows\INetCache\darktable/cached_kernels_for_IntelRHDGraphics4000/demosaic_ppg.cl.bin.56ac8b023c68a58d3ee5aeb10e6d0fac'!
[opencl_load_program] could not load cached binary program, trying to compile source
[opencl_load_program] successfully loaded program from `C:\Program Files\darktable\share\darktable/kernels/demosaic_ppg.cl'
[opencl_build_program] could not build program: -43
[opencl_build_program] BUILD STATUS: -2
BUILD LOG:

[opencl_init] failed to compile program `demosaic_ppg.cl'!
[opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
[opencl_init] initial status of opencl enabled flag is OFF.

press any key to exit

My PC spec:
CPU: Intel I7 - 960 3.2Ghz
GPU: Intel HD Graphics 4000 and NVidia GT 730M 4GB
RAM: 16GB
OS: Windows 10 x64

GPU-Z shows that my card supports OpenCL 1.2 (CUDA)

Associated revisions

Revision 650c32ed
Added by Tobias Ellinghaus 9 months ago

Windows: Don't hardcode '/' in OpenCL paths

Maybe helping with bug #11908

Revision 92e7bf6c
Added by Tobias Ellinghaus 8 months ago

Windows: Don't hardcode '/' in OpenCL paths

Maybe helping with bug #11908

(cherry picked from commit 650c32edfdc0a6b884b73a7f0fe795fc15d3e3db)

History

#1 Updated by Peter Budai 10 months ago

NVidia GT 730M supports only OpenCL 1.1 (see https://www.geforce.com/hardware/notebook-gpus/geforce-gt-730m/specifications). I'm not sure what is the minimum requirement, but I recall something like you need at least OpenCL 1.2, so that's not likely to work.

Your Intel HD 4000 has only 350 MB memory for allocation, and that is way to low.

Please read the usermanual on OpenCL here:
http://www.darktable.org/usermanual/en/darktable_and_opencl.html

#2 Updated by Roman Lebedev 10 months ago

Peter Budai wrote:

NVidia GT 730M supports only OpenCL 1.1 (see https://www.geforce.com/hardware/notebook-gpus/geforce-gt-730m/specifications). I'm not sure what is the minimum requirement, but I recall something like you need at least OpenCL 1.2, so that's not likely to work.

Last time i checked it was stated like "1.0 minus the bits that were deprecated later on in 1.1/1.2"

Your Intel HD 4000 has only 350 MB memory for allocation, and that is way to low.

Please read the usermanual on OpenCL here:
http://www.darktable.org/usermanual/en/darktable_and_opencl.html

#3 Updated by Eniz Ka 10 months ago

Hi Peter,
Actually my GPUZ Shows that my card supports OpenCL 1.2. I double checked.
I installed the darktable in a folder location without spaces in the path.

Was: Ex: "C:\Program Files\darktable"
Now isL "C:\darktable"

and now the error -43 is gone and now the error is:

[opencl_init] compiling program `demosaic_ppg.cl' ..
[opencl_fopen_stat] could not open file `C:\Users\EK\AppData\Local\Microsoft\Windows\INetCache\darktable/cached_kernels_for_IntelRHDGraphics4000/basic.cl.bin.8d8ce8f0d70148b459fc938bee468921'!
[opencl_load_program] could not load cached binary program, trying to compile source
[opencl_load_program] successfully loaded program from `C:\darktable\share\darktable/kernels/demosaic_ppg.cl'
[opencl_build_program] could not build program: -11
[opencl_build_program] BUILD STATUS: -2
BUILD LOG:
:21:10: fatal error: 'common.h' file not found
#include "common.h" 

I tried to include declarations from the common.h to demosaic_ppg.cl as macros and it compiled fine. Bu all files requiring common.h fails.

I suppose that the problem is that OpenCl configuration cant find common.h because of wrong path. Maybe Windows & Linux issues but i dont have a time to compile it under Windows now.

#4 Updated by Eniz Ka 10 months ago

My workaround was to copy all constants and functions

-----> common.h

int
FC(const int row, const int col, const unsigned int filters)
{
  return filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3;
}

to the file ----> demosaic_ppg.cl

  #define FC(row,col, filters) (filters >> ((((row) << 1 & 14) + ((col) & 1)) << 1) & 3)


This can cause side effects but i just wanted to try:

Also im not sure how this function can be translated to the macro

int
FCxtrans(const int row, const int col, global const unsigned char (*const xtrans)[6]) {
return xtrans[row % 6][col % 6];
}

#5 Updated by Peter Budai 9 months ago

Eniz, could you give a try with the latest darktable 2.4.1? We have built additional debug information into the OpenCL initialization, and we hope to get more information what went wrong with this case.
Please install the latest version and run darktable-cltest.exe and copy here the result.

#6 Updated by Peter Budai 9 months ago

Also I have found this: https://redmine.darktable.org/issues/11423
where OpenCL was complaining very similarly on not finding common.h - in that particlar case on OSX, but as I see the same card Intel HD Graphics 4000

#7 Updated by Eniz Ka 9 months ago

Microsoft Windows [Version 10.0.16299.192]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\darktable\bin>darktable.exe -d -opencl

C:\darktable\bin>./darktable.exe -d -opencl
'.' is not recognized as an internal or external command,
operable program or batch file.

C:\darktable\bin>darktable.exe -d -opencl

C:\darktable\bin>darktable-cltest
[opencl_init] opencl related configuration options:
[opencl_init]
[opencl_init] opencl: 1
[opencl_init] opencl_library: ''
[opencl_init] opencl_memory_requirement: 768
[opencl_init] opencl_memory_headroom: 300
[opencl_init] opencl_device_priority: '*/!0,*/*/*'
[opencl_init] opencl_mandatory_timeout: 200
[opencl_init] opencl_size_roundup: 16
[opencl_init] opencl_async_pixelpipe: 0
[opencl_init] opencl_synch_cache: 0
[opencl_init] opencl_number_event_handles: 25
[opencl_init] opencl_micro_nap: 1000
[opencl_init] opencl_use_pinned_memory: 0
[opencl_init] opencl_use_cpu_devices: 0
[opencl_init] opencl_avoid_atomics: 0
[opencl_init]
[opencl_init] found opencl runtime library 'OpenCL.dll'
[opencl_init] opencl library 'OpenCL.dll' found on your system and loaded
[opencl_init] found 2 platforms
[opencl_init] found 3 devices
[opencl_init] discarding CPU device 0 `      Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz'.
[opencl_init] device 1 `Intel(R) HD Graphics 4000' supports image sizes of 16384 x 16384
[opencl_init] device 1 `Intel(R) HD Graphics 4000' allows GPU memory allocations of up to 350MB
[opencl_init] device 1: Intel(R) HD Graphics 4000
     GLOBAL_MEM_SIZE:          1400MB
     MAX_WORK_GROUP_SIZE:      512
     MAX_WORK_ITEM_DIMENSIONS: 3
     MAX_WORK_ITEM_SIZES:      [ 512 512 512 ]
     DRIVER_VERSION:           10.18.10.4358
     DEVICE_VERSION:           OpenCL 1.2
[opencl_init] options for OpenCL compiler: -cl-fast-relaxed-math  -DINTEL=1 -I"C:\darktable\share\darktable/kernels" 
[opencl_init] compiling program `demosaic_ppg.cl' ..
[opencl_fopen_stat] could not open file `C:\Users\EK\AppData\Local\Microsoft\Windows\INetCache\darktable/cached_kernels_for_IntelRHDGraphics4000/demosaic_ppg.cl.bin.4f9d80733d3fa8fbb1209a8c54a3b596'!
[opencl_load_program] could not load cached binary program, trying to compile source
[opencl_load_program] successfully loaded program from `C:\darktable\share\darktable/kernels/demosaic_ppg.cl'
[opencl_build_program] could not build program: -11
[opencl_build_program] BUILD STATUS: -2
BUILD LOG:
:19:10: fatal error: 'common.h' file not found
#include "common.h" 
         ^

error: front end compiler failed build.
[opencl_init] failed to compile program `demosaic_ppg.cl'!
[opencl_init] FINALLY: opencl is NOT AVAILABLE on this system.
[opencl_init] initial status of opencl enabled flag is OFF.

press any key to exit

C:\darktable\bin>

I tried to build it under windows but build instructions are not up to date i think. Maybe if i try to debug under windows i get give some additional info

#8 Updated by Roman Lebedev 9 months ago

Eniz Ka wrote:

[...]

I tried to build it under windows but build instructions are not up to date i think. Maybe if i try to debug under windows i get give some additional info

It will not be any faster with that GPU, very well may be slower.

That being said

[opencl_init] options for OpenCL compiler: -cl-fast-relaxed-math -DINTEL=1 -I"C:\darktable\share\darktable/kernels"

looks kinda strange. I wonder if either "C:\darktable\share\darktable\kernels" or "C:/darktable/share/darktable/kernels" would work.
(Or maybe there is "-v" option you can pass?)

#9 Updated by Tobias Ellinghaus 9 months ago

I don't think that makes a difference, but one never knows. So I changed all the hard coded '/' to be '\' on Windows.

#10 Updated by Eniz Ka 9 months ago

I find a workaround of the problem. The problem is with the OpenCl files paths.
I replaced all include directive paths with their absolute paths and now opencl is loaded and working.

Example:

#include "common.h"  ->>  #include "C:\darktable\share\darktable\kernels\common.h" 

#11 Updated by Peter Budai 9 months ago

Interesting. Just out of curiosity: what happens when you use instead of the backslashes in one place a forward slash, like

instead "C:\darktable\share\darktable\kernels\common.h" -> "C:\darktable\share\darktable/kernels\common.h"

#12 Updated by Eniz Ka 9 months ago

Peter Budai wrote:

Interesting. Just out of curiosity: what happens when you use instead of the backslashes in one place a forward slash, like

instead "C:\darktable\share\darktable\kernels\common.h" -> "C:\darktable\share\darktable/kernels\common.h"

Peter, it works fine. It seems that is not affecting the compilation

#13 Updated by Peter Budai 9 months ago

OK, thanks. I still hope that the fix houz implemented for the compile include lines would solve the problem - watch for the next release. So far this problem seems to me very specific for intel HD 4000 cards, at least I have seen similar problems reported with the same card.

Also available in: Atom PDF