note also that bytes=. n * 4 even for J64 since that is sizeof(float) or sizeof(int) On Nov 17, 2015 10:58 AM, "Joe Bogner" <[email protected]> wrote:
> Pascal - I have a i7-3520M with an integrated Intel HD 4000 (on a > lenovo laptop). Nothing special I think. I agree it's an > unconventional opencl usage. I'm thinking it may be fun to try and > write a simple game and use the byte code as the language and opencl > as the game loop. The input to the loop would be the loop code, > pressed keys, and possibly some other state and the output would be a > frame to draw. I'm thinking outputting the image frame with something > like glpixels > http://jsoftware.2058.n7.nabble.com/about-glpixel-or-glpixels-td6030.html > > Bill, thanks for the and suggestion on ints. I intended to go that > route so thanks for jump starting me in that direction. > > > On Mon, Nov 16, 2015 at 7:56 PM, bill lam <[email protected]> wrote: > > signature of some opencl api contains l (64-bit integer) but J32 does not > > support l, so I use a hack to pass an integer as a 64-bit double. J64 > does > > not need this hack, so that it can use l and i2d is not needed. Changing > > all d to l in signatures _and_ i2d to ] for J64. Or just keeping them if > > you don't want different branches for J32 and J64. > > > > In you bytecode interpreter, integers can be used instead of float, you > can > > use write another > > > > clEnqueueReadBuffer_i=: (libopencl,' clEnqueueReadBuffer > i x x i x x > *i i > > *x *x')&cd > > > > similarly for clEnqueueWriteBuffer_i > > > > opencl should be available in all platforms where J can run, perhaps > except > > raspberry pi. > > On Nov 17, 2015 5:41 AM, "Joe Bogner" <[email protected]> wrote: > > > >> 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 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
