www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Need importing dcompute.lib into my project

reply kerdemdemir <kerdemdemir hotmail.com> writes:
Hi,

I have a cuda kernel already working in my cpp 
project(https://github.com/kerdemdemir/CUDABeamformer/blob/master/CudaBeamformer/kernel.cu)

I am trying to convert this to D with using DCompute. I already 
compiled the DCompute source code and have dcompute.lib. But I am 
really not good with using libraries and don't know how to use 
DCompute in my D 
project(https://github.com/kerdemdemir/DSharpEar/tree/master/DSharpEar). I am
not using DUB and compiling with VisualD.

Can you guys please help with importing DCompute into my project?

Regards
Erdem
Oct 06 2017
parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Friday, 6 October 2017 at 18:12:43 UTC, kerdemdemir wrote:
 Hi,

 I have a cuda kernel already working in my cpp 
 project(https://github.com/kerdemdemir/CUDABeamformer/blob/master/CudaBeamformer/kernel.cu)

 I am trying to convert this to D with using DCompute. I already 
 compiled the DCompute source code and have dcompute.lib. But I 
 am really not good with using libraries and don't know how to 
 use DCompute in my D 
 project(https://github.com/kerdemdemir/DSharpEar/tree/master/DSharpEar). I am
not using DUB and compiling with VisualD.

 Can you guys please help with importing DCompute into my 
 project?

 Regards
 Erdem
You should add DCompute as a DUB dependancy.
Oct 06 2017
parent reply kerdemdemir <kerdemdemir hotmail.com> writes:
 You should add DCompute as a DUB dependancy.
Hi, I inited my project with Dub by unsing "dub init DSharpEar" and I added dependency "dcompute". Even I give extra parameters for using ldc. dub build --compiler=D:\LDCDownload\bin\ldc2.exe --force I am getting : Error: static assert "Need to use a DCompute enabled compiler" Any suggestions? Regards Erdem
Oct 07 2017
next sibling parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Saturday, 7 October 2017 at 09:04:26 UTC, kerdemdemir wrote:
 You should add DCompute as a DUB dependancy.
Hi, I inited my project with Dub by unsing "dub init DSharpEar" and I added dependency "dcompute". Even I give extra parameters for using ldc. dub build --compiler=D:\LDCDownload\bin\ldc2.exe --force I am getting : Error: static assert "Need to use a DCompute enabled compiler" Any suggestions? Regards Erdem
do you set "-mdcompute-targets=cuda-xxx" in the dflags for your dub.json for your project?
Oct 07 2017
parent reply kerdemdemir <kerdemdemir hotmail.com> writes:
 do you set "-mdcompute-targets=cuda-xxx" in the dflags for your 
 dub.json for your project?
I have added now after your comment. But it seems it didn't changed anything. Here is the dub.json file I have: { "name": "dsharpear", "authors": [ "Erdem" ], "dflags" : ["-mdcompute-targets=cuda-210" ,"-oq", "-betterC"], "dependencies": { "dcompute": ">=0.0.0-alpha0 <0.1.0" }, "description": "Beamforming with D ", "copyright": "Copyright © 2017, Erdem", "license": "proprietary" } And running "dub build --compiler=D:\LDCDownload\bin\ldc2.exe --force" fails with: Performing "debug" build using D:\LDCDownload\bin\ldc2.exe for x86. derelict-util 2.1.0: building configuration "library"... derelict-cl 2.0.0: building configuration "library"... derelict-cuda 2.0.1: building configuration "library"... ..\..\..\..\..\AppData\Roaming\dub\packages\derelict-cuda-2.0.1\derelict-cuda\source\derelict\cuda\ untimeapi.d(816,5): Deprecation: constructor derelict.cuda.runtimeapi.dim3.this all parameters have default arguments, but structs cannot have default constructors. dcompute 0.0.0-alpha0: building configuration "library"... Targeting 'i686-pc-windows-msvc' (CPU 'pentium4' with features '') Building type: real Building type: uint Building type: char Building type: ubyte Building type: ulong Building type: int Building type: double Building type: long Building type: ushort Building type: wchar Building type: byte Building type: short Building type: float Building type: dchar ..\..\..\..\..\AppData\Roaming\dub\packages\dcompute-0.0.0-alpha0\dcompute\source\dcompute std\package.d(6,5): Error: static assert "Need to use a DCompute enabled compiler See https://github.com/thewilsonator/ldc/tree/dcompute" D:\LDCDownload\bin\ldc2.exe failed with exit code 1.
Oct 07 2017
parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Saturday, 7 October 2017 at 10:34:15 UTC, kerdemdemir wrote:
 do you set "-mdcompute-targets=cuda-xxx" in the dflags for 
 your dub.json for your project?
I have added now after your comment. But it seems it didn't changed anything. Here is the dub.json file I have: { "name": "dsharpear", "authors": [ "Erdem" ], "dflags" : ["-mdcompute-targets=cuda-210" ,"-oq", "-betterC"], "dependencies": { "dcompute": ">=0.0.0-alpha0 <0.1.0" }, "description": "Beamforming with D ", "copyright": "Copyright © 2017, Erdem", "license": "proprietary" } And running "dub build --compiler=D:\LDCDownload\bin\ldc2.exe --force" fails with: Performing "debug" build using D:\LDCDownload\bin\ldc2.exe for x86. derelict-util 2.1.0: building configuration "library"... derelict-cl 2.0.0: building configuration "library"... derelict-cuda 2.0.1: building configuration "library"... ..\..\..\..\..\AppData\Roaming\dub\packages\derelict-cuda-2.0.1\derelict-cuda\source\derelict\cuda\ untimeapi.d(816,5): Deprecation: constructor derelict.cuda.runtimeapi.dim3.this all parameters have default arguments, but structs cannot have default constructors. dcompute 0.0.0-alpha0: building configuration "library"... Targeting 'i686-pc-windows-msvc' (CPU 'pentium4' with features '') Building type: real Building type: uint Building type: char Building type: ubyte Building type: ulong Building type: int Building type: double Building type: long Building type: ushort Building type: wchar Building type: byte Building type: short Building type: float Building type: dchar ..\..\..\..\..\AppData\Roaming\dub\packages\dcompute-0.0.0-alpha0\dcompute\source\dcompute std\package.d(6,5): Error: static assert "Need to use a DCompute enabled compiler See https://github.com/thewilsonator/ldc/tree/dcompute" D:\LDCDownload\bin\ldc2.exe failed with exit code 1.
You are using an old DCompute: that message was changed in https://github.com/libmir/dcompute/commit/cf1420d5377c48f9132f1a9a0f8f06ebb46a6433#diff-b0637c2cde07f2ec8f77f9e3d379fff7 I'm not quite sure how the dub version specs work but I believe "dcompute": "~>0.0.0" should work, or you can force it to use master. I'm still not sure why it fails with that error though, are you using an old LDC as well? 1.4.0 should work.
Oct 08 2017
next sibling parent reply kerdemdemir <kerdemdemir hotmail.com> writes:
On Sunday, 8 October 2017 at 07:51:12 UTC, Nicholas Wilson wrote:
 On Saturday, 7 October 2017 at 10:34:15 UTC, kerdemdemir wrote:
 do you set "-mdcompute-targets=cuda-xxx" in the dflags for 
 your dub.json for your project?
I have added now after your comment. But it seems it didn't changed anything. Here is the dub.json file I have: { "name": "dsharpear", "authors": [ "Erdem" ], "dflags" : ["-mdcompute-targets=cuda-210" ,"-oq", "-betterC"], "dependencies": { "dcompute": ">=0.0.0-alpha0 <0.1.0" }, "description": "Beamforming with D ", "copyright": "Copyright © 2017, Erdem", "license": "proprietary" } And running "dub build --compiler=D:\LDCDownload\bin\ldc2.exe --force" fails with: Performing "debug" build using D:\LDCDownload\bin\ldc2.exe for x86. derelict-util 2.1.0: building configuration "library"... derelict-cl 2.0.0: building configuration "library"... derelict-cuda 2.0.1: building configuration "library"... ..\..\..\..\..\AppData\Roaming\dub\packages\derelict-cuda-2.0.1\derelict-cuda\source\derelict\cuda\ untimeapi.d(816,5): Deprecation: constructor derelict.cuda.runtimeapi.dim3.this all parameters have default arguments, but structs cannot have default constructors. dcompute 0.0.0-alpha0: building configuration "library"... Targeting 'i686-pc-windows-msvc' (CPU 'pentium4' with features '') Building type: real Building type: uint Building type: char Building type: ubyte Building type: ulong Building type: int Building type: double Building type: long Building type: ushort Building type: wchar Building type: byte Building type: short Building type: float Building type: dchar ..\..\..\..\..\AppData\Roaming\dub\packages\dcompute-0.0.0-alpha0\dcompute\source\dcompute std\package.d(6,5): Error: static assert "Need to use a DCompute enabled compiler See https://github.com/thewilsonator/ldc/tree/dcompute" D:\LDCDownload\bin\ldc2.exe failed with exit code 1.
You are using an old DCompute: that message was changed in https://github.com/libmir/dcompute/commit/cf1420d5377c48f9132f1a9a0f8f06ebb46a6433#diff-b0637c2cde07f2ec8f77f9e3d379fff7 I'm not quite sure how the dub version specs work but I believe "dcompute": "~>0.0.0" should work, or you can force it to use master. I'm still not sure why it fails with that error though, are you using an old LDC as well? 1.4.0 should work.
I changed my dependency setting in dub file to "dcompute": "~>0.0.0" but still getting the same error message. By the way I am sure my LDC version is good because I can build DCompute source code with same LDC version.
Oct 13 2017
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 10/13/2017 08:47 AM, kerdemdemir wrote:

 I changed my dependency setting in dub file to "dcompute": "~>0.0.0" but
 still getting the same error message. By the way I am sure my LDC
 version is good because I can build DCompute source code with same LDC
 version.
Could this be related to difference in platform like Windows vs. Linux? If so, may be it makes sense to work in a VM that has Nicholas's exact setup. Ali
Oct 13 2017
parent kerdemdemir <kerdemdemir hotmail.com> writes:
On Friday, 13 October 2017 at 16:36:06 UTC, Ali Çehreli wrote:
 On 10/13/2017 08:47 AM, kerdemdemir wrote:

 I changed my dependency setting in dub file to "dcompute":
"~>0.0.0" but
 still getting the same error message. By the way I am sure my
LDC
 version is good because I can build DCompute source code with
same LDC
 version.
Could this be related to difference in platform like Windows vs. Linux? If so, may be it makes sense to work in a VM that has Nicholas's exact setup. Ali
It make sense for me to switch back to linux. I ruined my multiboot linux system which has only 20gb root partition while trying to install CUDA libraries(which takes a lot of space.). Maybe as you suggest instead of trying with windows I need to reinstall my linux.
Oct 13 2017
prev sibling parent jmh530 <john.michael.hall gmail.com> writes:
On Sunday, 8 October 2017 at 07:51:12 UTC, Nicholas Wilson wrote:
 You are using an old DCompute: that message was changed in 
 https://github.com/libmir/dcompute/commit/cf1420d5377c48f9132f1a9a0f8f06ebb46a6433#diff-b0637c2cde07f2ec8f77f9e3d379fff7

 I'm not quite sure how the dub version specs work but I believe 
 "dcompute": "~>0.0.0" should work, or you can force it to use 
 master.
 I'm still not sure why it fails with that error though, are you 
 using an old LDC as well? 1.4.0 should work.
You have any experience with master being quirky? I can't dub fetch through the firewall at work so I have to install packages manually. You have to do dub add-local [package] [version] so if you actually download master, you have have to give it a version number anyway. I usually just manually bump it one. Kind of annoying, but works.
Oct 13 2017
prev sibling parent reply kinke <noone nowhere.com> writes:
On Saturday, 7 October 2017 at 09:04:26 UTC, kerdemdemir wrote:
 Error: static assert  "Need to use a DCompute enabled compiler"
Are you using latest LDC 1.4? The CUDA backend wasn't enabled for earlier versions.
Oct 07 2017
parent kerdemdemir <kerdemdemir hotmail.com> writes:
On Saturday, 7 October 2017 at 12:12:10 UTC, kinke wrote:
 On Saturday, 7 October 2017 at 09:04:26 UTC, kerdemdemir wrote:
 Error: static assert  "Need to use a DCompute enabled compiler"
Are you using latest LDC 1.4? The CUDA backend wasn't enabled for earlier versions.
Yes I am. Actually I can build dcompute's source code so I am sure LDC version is good. Now I am trying to use dcompute within my project.
Oct 07 2017