www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How DerelictCL works

reply bioinfornatics <bioinfornatics fedoraproject.org> writes:
Dear,

I would like to use OpenCL in D. Thus I try to use DerelictCL.
But I fail to use it I encounter this error message:
--------------
/opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/openc
/constants.di(835): Error: genCLVectorTypes cannot be interpreted at compile
time, because it has no available source code
/opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constant
.di-mixin-835(835): Error: declaration expected, not <
--------------


The tiny D file is:
------test_opencl.d--------

import derelict.opencl.cl;

void main() {
     // Load the OpenCL library.
     DerelictCL.load();
}
---------------------------


The compile line is:

--------------
ldc2  -I /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/ 
\
       -L-L/usr/lib64 \
       -L-L/opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64 \
       -L-lOpenCL \
       -L-lDerelictUtil \
       -L-lDerelictCL \
       -of test \
       test_opencl.d
--------------

library are located at:
OpenL           /usr/lib64/libOpenCL.so
DerelictUtil    
/opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64/libDerelictUtil.so
DerelictCL      
/opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64/libDerelictCL.so

Derelict include files:= are located at:
  - /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/


Thanks for your help

Best regards
Jul 21 2020
next sibling parent aberba <karabutaworld gmail.com> writes:
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote:
 Dear,

 I would like to use OpenCL in D. Thus I try to use DerelictCL.
 But I fail to use it I encounter this error message:
 --------------
 /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/openc
/constants.di(835): Error: genCLVectorTypes cannot be interpreted at compile
time, because it has no available source code
 /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constant
.di-mixin-835(835): Error: declaration expected, not <
 --------------

 [...]
Have you install the libopencl** dev dependencies?
Jul 21 2020
prev sibling next sibling parent Mike Parker <aldacron gmail.com> writes:
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote:
 Dear,

 I would like to use OpenCL in D. Thus I try to use DerelictCL.
 But I fail to use it I encounter this error message:
 --------------
 /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/openc
/constants.di(835): Error: genCLVectorTypes cannot be interpreted at compile
time, because it has no available source code
 /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constant
.di-mixin-835(835): Error: declaration expected, not <
 --------------
Looks like an issue in a code gen function. It might be due to changes in LDC. I'll ping Guillaume.
Jul 21 2020
prev sibling next sibling parent Guillaume Piolat <first.name gmail.com> writes:
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote:
 Dear,

 I would like to use OpenCL in D. Thus I try to use DerelictCL.
 But I fail to use it I encounter this error message:
Hello, I don't have time at all at the moment for maintaining DerelictCL, can you provide a fully working PR that fix your problem? I will then make a git tag. Guillaume
Jul 22 2020
prev sibling parent WebFreak001 <d.forum webfreak.org> writes:
On Tuesday, 21 July 2020 at 12:00:03 UTC, bioinfornatics wrote:
 Dear,

 I would like to use OpenCL in D. Thus I try to use DerelictCL.
 But I fail to use it I encounter this error message:
 --------------
 /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/openc
/constants.di(835): Error: genCLVectorTypes cannot be interpreted at compile
time, because it has no available source code
 /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/derelict/opencl/constant
.di-mixin-835(835): Error: declaration expected, not <
 --------------


 The tiny D file is:
 ------test_opencl.d--------

 import derelict.opencl.cl;

 void main() {
     // Load the OpenCL library.
     DerelictCL.load();
 }
 ---------------------------


 The compile line is:

 --------------
 ldc2  -I 
 /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/ \
       -L-L/usr/lib64 \
       -L-L/opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64 \
       -L-lOpenCL \
       -L-lDerelictUtil \
       -L-lDerelictCL \
       -of test \
       test_opencl.d
 --------------

 library are located at:
 OpenL           /usr/lib64/libOpenCL.so
 DerelictUtil    
 /opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64/libDerelictUtil.so
 DerelictCL      
 /opt/jonathan/jonathan-dlang_ldc2092/root/usr/lib64/libDerelictCL.so

 Derelict include files:= are located at:
  - /opt/jonathan/jonathan-dlang_ldc2092/root/usr/include/d/


 Thanks for your help

 Best regards
where did you get these .di files from you have in your include directory? I don't think these are officially produced by the derelict-cl library and are the reason why your compilation is breaking. (it wants to evaluate some function at compile time, probably some CTFE or manifest constant, which fails because it only has definitions inside the .di file and not the function implementation)
Jul 22 2020