Syncleus / aparapi

The New Official Aparapi: a framework for executing native Java and Scala code on the GPU.

Home Page:http://aparapi.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kernel.execute(_range, _passes) used much host memory when _passes > 1

freemo opened this issue · comments

Copied from google code here: https://code.google.com/archive/p/aparapi/issues/69
tested in unit test here: https://github.com/Syncleus/aparapi/blob/master/src/test/java/com/aparapi/runtime/MultiplePassesMemoryConsumptionTest.java

When I run this I get about a 2.3 mb memory consumption increase when passes is increased to 2. Originally the issue caused an out of memory exception off the same test. So I will close this ticket for now as it is passing. But I will keep the issue here for reference,

Original text from issue below:

What steps will reproduce the problem? 1.Attached Main.Java used much host memory

What is the expected output? What do you see instead? LINE 14: kernel.execute(Range.create(512, 64), 2); // <- used huge memory and throw OutOfMemoryError but... LINE 14: kernel.execute(Range.create(512, 64), 1); // <- not huge why happened?

What version of the product are you using? On what operating system? aparapi-2012-05-06, Windows7 SP1 64bit, NVIDIA GeForce GTX 680 as GPU. (can GTX680 write clinfo?)

Please provide any additional information below. I think Main class used huge memory only when -Dcom.amd.aparapi.executionMode=gpu...

Attachments
Main.java 464
Comment #1
Posted on Sep 12, 2012 by Happy Elephant
Thanks for reporting this.

Do you have the capability of building Aparapi from the trunk?

If so then there is a cltest target in the com.amd.aparapi.jni tree which will report opencl information regarding your runtime and device.

Just cd to trunk/com.amd.aparapi.jni and issue 'ant cltest'

This will create a 64 bit or 32 bit executable which can be run to determine opencl runtime info.

If you can't build it. Then I can send you a binary version which should work (send me an email to frost.gary@gmail.com and I will send you a copy)

I have not been able to recreate this with the trunk version.

Of course I am also using AMD's runtime ;)

Gary

Comment #2
Posted on Sep 13, 2012 by Quick Rhino
This is my cltest output. Thanks.

(Please ignore my poor mail..)

Attachments
cltest.txt 2.87KB
Comment #3
Posted on Sep 13, 2012 by Happy Elephant
Looks like you were able to build from the trunk.

I have one of these cards somewhere so should be able to quickly verify.

Now you have the trunk, and can build. Can you build the whole of aparapi and try the latest trunk version. Just to see if the problem still exists for you from the trunk.

I plan to test from the trunk, and would prefer to know that you still see the issue when using the trunk.

Thanks

Gary

Comment #4
Posted on Sep 13, 2012 by Quick Rhino
Thanks. but I had a trouble and I can't try trunk version...

Ant said BUILD SUCCESSFUL in build.xml of root directory. I copied new aparapi.jar, aparapi_x86_64.dll into "aparapi-2012-05-06" directory. running "life" sample, I got error...

C:\Users***\lib\aparapi-2012-05-06\samples\life>java -Djava.library.path=.. /.. -Dcom.amd.aparapi.executionMode= -Dcom.amd.aparapi.enableProfiling=true - classpath ../../aparapi.jar;life.jar com.amd.aparapi.sample.life.Main Check your environment. Failed to load aparapi native library aparapi_x86_64 or possibly failed to locate opencl native library (opencl.dll/opencl.so). Ensure t hat both are in your PATH (windows) or in LD_LIBRARY_PATH (linux). range = global:1179648 local:256

And after this, copied old backup (aparapi.jar, aparapi_x86_64.dll) to "aparapi-2012-05-06", I got great speed with GPU and no error.

So I think I don't make a mistake about PATH... what should i do?

Comment #5
Posted on Sep 13, 2012 by Happy Elephant
So I assume after the build you had a new aparapi.jar in com.amd.aparapi\dist and a new aparapi_x86_64.dll in com.amd.aparapi.jni\dist

After a successful build from the 'trunk' dir. The life.bat in trunk/samples/life should just work. It will point to ....\com.amd.aparapi\dist for aparapi.jar and ....\com.amd.aparapi.jni\dist for the dll.

You should not have to move/copy anything

When we build the 'dist' target we automatically 'hack' the bat files and change the paths...

Try running from the trunk\samples\life dir.

Gary

Comment #6
Posted on Sep 14, 2012 by Quick Rhino
I how noob.. ;(

I tried it. But the same error occurs.. Of course I checked paths in life.bat. I think those are right.

and I wonder whether there are differences in the jar and dll that is built by the environment. Could you send me trunk ver jar and dll you build ..?

Comment #7
Posted on Sep 14, 2012 by Happy Elephant
I attached a copy of my dist build (for Win 64 bit only!)

Let me know if this works.

Attachments
dist_windows_x86_64.zip 1.02MB
Comment #8
Posted on Sep 14, 2012 by Quick Rhino
Very Thanks! I download your zip and run "life.bat". But yours also says ...
Check your environment. Failed to load aparapi native library aparapi_x86_64 or possibly failed to locate opencl native library (opencl.dll/opencl.so). Ensure t hat both are in your PATH (windows) or in LD_LIBRARY_PATH (linux).

I redownload aparapi-2012-05-06 and retry "life" of 2012-05-06 now .. and of course it goes fine.

Comment #9
Posted on Sep 14, 2012 by Happy Elephant
Hmm this looks like an OpenCL runtime incompatibility.

Lets do this the other way around ;)

Can you rebuild from the trunk (recreating the dll issue for you) and then send me (or attache here) a zip of your aparapi.jar and aparapi_x86_64.dll.

I will then a) Test your dll/jar on my system b) look at symbols to see if there are any weird dependencies.

BTW did you download AMD APP SDK in order to build cltest?

What version did you install?

My suspicion is that the APPSDK is for OpenCL 1.2 and although you have (or should have) AMD OpenCL 1.2, your NVIDIA driver is probably 1.1

Previous builds of Aparapi were built on OpenCL 1.1.

Yeah I know this is confusing.

Oh wait. You posted your cltest output, we should be able to verify this assumption

Yes, so look here

platform 0{ CL_PLATFORM_VENDOR.."NVIDIA Corporation" CL_PLATFORM_VERSION."OpenCL 1.1 CUDA 4.2.1" ... platform 1{ CL_PLATFORM_VENDOR.."Advanced Micro Devices, Inc." CL_PLATFORM_VERSION."OpenCL 1.2 AMD-APP (923.1)" ...

So when you or I compile Aparapi it builds for OpenCL 1.2 (you have the latest AMD APP SDK I think - I know I do) the aparapi_x86_64 dll has symbols expected to be resolved by an OpenCL 1.2 runtime.

At runtime the only GPU device that you have is for the NVIDIA device which only has a 1.1 runtime available. So can't resolve the 1.2 symbols.

If I am right. I should be able to run your jar and dll on my machine.

Send me (or attach) the files to confirm. Thanks for helping me debug this.

Gary

Comment #10
Posted on Sep 14, 2012 by Quick Rhino
Yes! I installed AMD APP SDK v2.7 (for OpenCL 1.2). But are there older version of appsdk?

Please test my jar and dll.

Attachments
aparapi.jar 482.08KB
aparapi_x86_64.dll 149.5KB