OpenCL (Open Coumputer Language) for FreeBASIC .

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by D.J.Peters »

You are right it must be "size_t" fixed in the zip file.

In test02.bas change line 84:
dim as size_t nChars

Joshy
chung
Posts: 648
Joined: Jan 16, 2010 20:52
Location: France
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by chung »

hi dj !
can you please post cl.bi on dropbox or another website , your alice website is marked as "malware" , this is also true for your other stuff ...
thanks
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by D.J.Peters »

Because of malware on alice-dsl.net domain I moved all content to my new shiny3d.de server.

Joshy
chung
Posts: 648
Joined: Jan 16, 2010 20:52
Location: France
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by chung »

there must be a problem , now my browser tells me the file is infected ...
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by D.J.Peters »

chung wrote:there must be a problem , now my browser tells me the file is infected ...
the content of the *.zip file are only: *.bi *.bas *.txt and *.pdf

This stuff isn't infected (trust me) :-)

Joshy
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by D.J.Peters »

New version uploaded and tested on 32/64-bit successful.

On my WINDOWS10 64-bit box are this two *.dlls
C:\Program Files\NVIDIA Corporation\OpenCL\OpenCL.dll
C:\Program Files\NVIDIA Corporation\OpenCL\OpenCL64.dll

only #inclib "OpenCL64" works here !
May be OpenCL64.dll loads internal OpenCL.dll also or OpenCL.dll are for 32-bit binaries (I don't know)

I created for WIN64 a new import library.

/FreeBASIC/lib/lib32/libOpenCL.dll.d
/FreeBASIC/lib/lib64/libOpenCL.dll.d
/FreeBASIC/lib/lib64/libOpenCL64.dll.d <-it's new

Joshy

the changes in file: cl.bi

Code: Select all

...
#ifdef __FB_WIN32__
 extern "Windows-MS"
 #ifdef __FB_64BIT__
  #inclib "OpenCL64"
 #else
  #inclib "OpenCL" 
 #endif 
#else
 extern "C"
 #inclib "OpenCL" 
#endif
...
h4tt3n
Posts: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by h4tt3n »

Okay, followed the fairly simple and straightforward instructions in the readme. Running on win10 64 bit. Get the error "The program can't start because OpenCL64.dll is missing from your computer." Am I supposed to download this file from somewhere, or do I rename one of the files in opencl.zip file? Despite years of programming, these dll errors effortlessly wins the first place when it comes to frustrating problems - and there's a looong way down to second place.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by D.J.Peters »

@h4tt3n same here I made a copy from C:\Program Files\NVIDIA Corporation\OpenCL to d:\fbExamples\OpenCL

Don't download it from anywhere it's a part of your gfxcard driver !

If your videocard support OpenCL than the folder with OpenCL.dll or OpenCL64.dll isn't in the environment var 'PATH'

search for OpenCL*.dll in your C: partition (where your windows are installed) and copy it to the folder where your *.exe is.

Let me know if you have only OpenCL.dll and not OpenCL64.dll !

Joshy
h4tt3n
Posts: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by h4tt3n »

Hi Joshy,

Searching my pc for anything opencl related gave no result, so there's a start. This might be explained by my laptop having a radeon graphics card, but according to the opencl website it should be supported by AMD too.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by D.J.Peters »

In thi s case download and install the AMD OpenCL SDK
(AMD OpenCL V2.0 is only for windows >=8.1 64-bit so far I know)

search for the AMD OpenCL V1 or V1.1 for your Readon chipset.

http://developer.amd.com/resources/arti ... -sdk-v2-4/

Joshy
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by speedfixer »

Hi, Joshy

I use Linux:
Lubuntu 16-04 x86_64
GeForce GTX 560 Ti
CUDA Cores: 384
NVIDIA Driver Version: 375.66
clinfo reports my card is present, etc. : 2.1 capability

A previous post suggested these object files could be used with Linux, also. True?

added to test01.bas:

#libpath "/rdkl/FB/OpenCL/OpenCL/lib/win64/"

changed cl.bi:

from:

#else
extern "C"
#inclib "OpenCLl"
#endif

to:

#else
extern "C"
#inclib "OpenCL64.dll"
#endif

Successful compile:
fbc test01.bas == segfault

recompile:
fbc -exx -g test01.bas

gdb say:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000405e88 in clGetPlatformIDs ()

(tried with other library - also successful compile - same result gdb message)
Am I using a wrong library? Does there need to be a different compiled library for Linux/Linux64?

Any other idea where I should look?


By the way, I would like to thank you for so much work keeping so many valuable libraries available to the FB community.

David
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by D.J.Peters »

@speedfixer the import libs OpenCL.dll.a and OpenCL64.dll.a are only used on Windows OS not Linux.

on linux #inclib "OpenCL" are linked to libOpenCL.so

I tested it on Ubuntu and Slackware.

may be you need the path to libOpenCl.so
fbc -p Path_to_OpenCL_on_your_box test01.bas

Joshy
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by speedfixer »

OK. I will play a bit and see how to do it all.

Thanks
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by speedfixer »

Simply needed to install the dev packages, that's all.
(removed all my edits - did NOT need the -p ... path add to the compile command)

So:

Linux 4.10.35 - Lubuntu 16.04
Processor : 6x AMD FX(tm)-6100 Six-Core Processor: 3300.00MHz
Memory : 8142MB (1818MB used)
GeForce GTX 560 Ti

test01: 1470+ frames
( but ... without -g -exx options --- 50 frames slower !!!)

test02: 3300-3700 fps - twitches way too fast

Thanks

David
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: OpenCL (Open Coumputer Language) for FreeBASIC .

Post by speedfixer »

For the demo in the first post, line 46 produced a warning: wrong type - parameter 6.

I simply remarked it out, since it looked like a corrected line was in line 49.

Is that correct?
Post Reply