That is a pretty unusual opencl application there Joe.  Interesting that its so 
fast.  What graphics card do you have?

I did bindings for arrayfire here https://github.com/Pascal-J/Jfire


which is a library that transparently switches between opencl cuda, and cpu 
code based on availability and what you choose.

It can't do what you just did:  write your own opencl kernel and execute it.

What it does instead is access wrappers around every (that I/you implement from 
dll import) raw C opencl function, or the kernels that come compiled with it 
(vision, fft, neural networks...)

Its also a decent architecture in terms of async execution, and it was fairly 
easy to wrap memory management around it.  There is an unfortunate download 
process, and I can see how opencl might be the only relevantly useful platform. 
 Nvidia cards should be reasonably ok at it.



----- Original Message -----
From: Joe Bogner <[email protected]>
To: [email protected]
Cc: 
Sent: Monday, November 16, 2015 4:41 PM
Subject: Re: [Jprogramming] opencl on android

bill, this is fantastic.

my machine (windows 7 / x64) already had a opencl.dll on it, which means
without any additional installation I was able generate C-like code and get
incredible performance. TCC does not generate optimized code compared to
gcc / msvc and requires an installation.

I was able to port a minimal example of my bytecode machine to your opencl
helper. More work to do, but preliminary results run 500,000 iterations in
0.071398 seconds compared to 8.88937 seconds for my tacit version.

Here's the crude start of it:
https://gist.github.com/joebo/f2db81090ef531e856c4

Compared to my
http://code.jsoftware.com/wiki/User:Joe_Bogner/ByteCodeInterpreter#Tacit_Literate.2C_TDD_Version




On Mon, Nov 16, 2015 at 12:20 PM, Joe Bogner <[email protected]> wrote:

> I was also thinking it reminded me of TCC. I am downloading the opencl
> drivers now to play
>
> Here's some work I did on TCC awhile back:
>
> https://github.com/joebo/lang-lab/blob/master/j/tcc.ijs
>
> http://www.jsoftware.com/pipermail/chat/2015-February/006490.html
>
>
> On Sun, Nov 15, 2015 at 11:34 PM, 'Pascal Jasmin' via Programming <
> [email protected]> wrote:
>
>> no other changes than linking to opencl.dll works on windows.
>> changing i2d =: ] segfaults.
>>
>> Looks like an interesting approach overall.  Complete control of opencl
>> programs from J.  It looks like considerable work to automate out the
>> repetition, but I can almost see how to write C code from J templates.  The
>> work would also be useful for TCC dynamic compilation.
>>
>>
>>
>>
>>
>> ----- Original Message -----
>> From: bill lam <[email protected]>
>> To: Programming forum <[email protected]>
>> Cc:
>> Sent: Sunday, November 15, 2015 6:33 PM
>> Subject: Re: [Jprogramming] opencl on android
>>
>> you should link to opencl.dll, the others are icd (installable client
>> driver). you can select vendor devices by twisting the first 2 lines,
>> clGetPlatformIDs 1; (platform=. ,_1); <<0
>> clGetDeviceIDs ({.platform); ({.@i2d _1); 1; (dev=. ,_1); <<0
>>
>> icd does not apply to android because google had killed official support
>> of
>> opencl in favor of his own renderscript, so that developers have to link
>> to
>> actual vendor's driver.
>> > just replace every d with l
>>
>> You mean function signature parameters d with l?... seems like a
>> surprising
>> substitution.
>>
>> On windows, I have opencl.dll in system32 and system.  And also have
>> various versions of amd_opencl(32/64).dll.  Do I just link to just
>> opencl.dll, and it will magically delegate to the right vendor's
>> implementation?
>>
>>
>>
>>
>> ----- Original Message -----
>> From: bill lam <[email protected]>
>> To: 'Pascal Jasmin' via Programming <[email protected]>
>> Cc:
>> Sent: Sunday, November 15, 2015 2:37 AM
>> Subject: Re: [Jprogramming] opencl on android
>>
>> Location of library depends on platform. It think it should work
>> on J32. It is simpler on J64, just replace every d with l and
>> change i2d to ] .
>>
>> In desktop, both CPU and GPU can provide devices, you may to
>> want to specify CPU or GPU in getting the device ID.
>>
>> Вс, 15 ноя 2015, jprogramming написал(а):
>> > haven't tested on android yet, but it doesn't work on windows... I guess
>> intentionally.
>> >
>> > Would the signatures be the same (or very close) on desktops... just the
>> library locations different?
>> >
>> > ________________________________
>> > From: bill lam <[email protected]>
>> > To: jprogramming <[email protected]>
>> > Sent: Sunday, November 15, 2015 1:27 AM
>> > Subject: [Jprogramming] opencl on android
>> >
>> >
>> > A demo script for running opencl on android, it should ouput
>> > 1 0 or 1 delta.
>> >
>> > Note that google does not want to you to run opencl on android
>> > so that this script may not work even if your android device
>> > is the newest flagship model. Search for "opencl" in google play
>> > for some apps that can check for opencl capability.
>> >
>> > Please report if your devices support opencl but this script failed.
>> >
>> >
>> > --
>> > regards,
>> > ====================================================
>> > GPG key 1024D/4434BAB3 2008-08-24
>> > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>> > gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
>> >
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>>
>> --
>> regards,
>> ====================================================
>> GPG key 1024D/4434BAB3 2008-08-24
>> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
>> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to