jordan30001 / aparapi

Automatically exported from code.google.com/p/aparapi
Other
0 stars 0 forks source link

GPU-Mode does not work on Mac Mini running Windows 7 #83

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Just start one of the samples (squares, add... doesn't matter) on Windows 7 
with GPU as execution mode
2. The error message listed below occurs and it gets executed via JTP.
3.

What is the expected output? What do you see instead?
Although I specify GPU to use as execution mode, the samples always get 
executed via JTP. The output in the beginning of program exeuction is:

"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 that both are in your PATH (windows) or in LD_LIBRARY_PATH (linux)."
Execution mode=JTP

What version of the product are you using? On what operating system?
I use the latest binary build available from the website, 
aparapi-2012-12-02.zip.

As a machine, I use an Apple Mac Mini with an Intel Core 2 Duo @2GHz, 4 GB RAM 
and an NVIDIA Geforce 9400M (I'm sorry! :) ) with the latest drivers. As 
operating system, I use Windows 7 x64 Professional with all updates installed.

Please provide any additional information below.

I have installed the latest Java 7 JDK as 64-Bit version:

"java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)"

I have not recompiled anything, just tried to execute the included samples. The 
OpenCL.dll is installed in various place, e.g. windows\system32 and this path 
is also stored in the PATH environment variable. The mentioned aparapi_x86_64 
is also stored in the default aparapi path.

Do you have any idea how to fix this issue?

Thanks in advance!

Original issue reported on code.google.com by hansbla...@googlemail.com on 9 Dec 2012 at 1:52

GoogleCodeExporter commented 9 years ago
We just had another person with a similar problem posting to the mailing list. 
The culprit is most likely that the latest Aparapi requires OpenCL 1.2 whereas 
it seems a lot of NVIDIA drivers are still using OpenCL 1.1. Are you using the 
latest possible video drivers from NVIDIA?

As a side note, I've been thinking for a while that we need to do two things 
with Aparapi:

- Provide a utility in the ZIP download that prints out all known 
CPU/GPU/OpenCL information for debugging purposes

- Have Aparapi output to the console more descriptive reasons for failure, such 
as "OpenCL 1.1 found but Aparapi requires OpenCL 1.2" or something similar

Original comment by ryan.lam...@gmail.com on 9 Dec 2012 at 11:11

GoogleCodeExporter commented 9 years ago
Something like http://www.ozone3d.net/gpu_caps_viewer/ would be excellent :)

Original comment by ryan.lam...@gmail.com on 9 Dec 2012 at 11:13

GoogleCodeExporter commented 9 years ago
Hello,

Thanks for your post! Indeed, I think that this may be the problem. I have the 
latest possible video drivers installed from NVIDIA and I also tried the GPU 
Caps viewer.

I noticed that the driver seems to support OpenCL 1.1 (and aparapi seems to 
rely on 1.2 as I found out later), but what really puzzles me is the 
information output by the GPU caps viewer that the Geforce 9400M seems to be 
only capable of supporting OpenCL 1.0. Maybe this is the problem and thus, your 
additions sound very reasonable to me.

As a side note, I use a Dell T7500 workstation at the office (2x Intel Xeon 
Hexacore, 96 GB RAM, NVIDIA Quadro 4000) running Red Hat Linux 5.0. On this 
machine, aparapi runs just fine in GPU mode and thus, the linux driver seems to 
be able to match aparapi's requirements for the correct OpenCL version. 
However, I cannot imagine that the NVIDIA linux drivers are more advanced than 
the Windows versions. Or maybe, in this case, the Quadro drivers are in general 
just newer and thus support OpenCL 1.2.

Tomorrow, I will create a screenshot from the GPU Caps Viewer and attach it to 
this issue thread.

Original comment by hansbla...@googlemail.com on 9 Dec 2012 at 11:41

GoogleCodeExporter commented 9 years ago
Attached you will find the output of the GPU Caps Viewer.

Do you think that the supported OpenCL version is the issue?

Original comment by hansbla...@googlemail.com on 10 Dec 2012 at 8:13

Attachments:

GoogleCodeExporter commented 9 years ago
Small update: I've read in the discussion group that the aparapi_x86_64 file 
seems to cause trouble and that 32-bit JVM should work. I have tested this 
again with the 32-bit JVM et voila, it's running fine now.

There is only one warning message. Do you have any idea where it comes from?

"Dez 11, 2012 9:24:43 PM com.amd.aparapi.MethodModel init
Warnung: Method run()V does not contain a LocalVariableTable entry (source not c
ompiled with -g) aparapi will attempt to create a synthetic table based on bytec
ode. This is experimental!!"

Original comment by hansbla...@googlemail.com on 11 Dec 2012 at 8:28

GoogleCodeExporter commented 9 years ago
Yes :) At one time, Aparapi *required* you to compile your class with -g. So 
that the class file parser could get help from the local variable table to 
determine for example the scope and names of local variables for OpenCL code 
generation. 

Some people don't like compiling with -g on, so just recently I added a patch 
which allows aparapi to 'synthesize its own table'.  This is new ;) and as the 
warning says, should be considered experimental (looks like it worked here! :)) 
you can get rid of this warning if you compile your Java app with -g. 

BTW we needed this patch so we can parse the synthetic methods created for Java 
8 Lambdas. As I crawl towards suppport for Java 8 Lamdas in Aparapi.  At 
present Java 8 lambda functions do not contain local variable tables (as if 
they were compiled with -g!). 

Garr

Gary

Original comment by frost.g...@gmail.com on 11 Dec 2012 at 9:02

GoogleCodeExporter commented 9 years ago
Ah, okay, that sounds reasonable!
I'm glad that it works now and maybe, this is the key for using the mobile 
workstation at the office for aparapi.

However, I'm wondering why aparapi_x86_64 seems to cause trouble.

Original comment by hansbla...@googlemail.com on 11 Dec 2012 at 9:08

GoogleCodeExporter commented 9 years ago
Yes me too.  I can't reproduce this. 

Original comment by frost.g...@gmail.com on 11 Dec 2012 at 9:11

GoogleCodeExporter commented 9 years ago
Well, does anyone with an AMD card has this issue as well? If I remember 
correctly, the other user who reported this problem and the solution first used 
an NVIDIA card like I do. Maybe there is something strange with the NVIDIA 
drivers.

Original comment by hansbla...@googlemail.com on 11 Dec 2012 at 9:22

GoogleCodeExporter commented 9 years ago
I have this same problem, it seems. I'm using Windows Vista 64-bit with a 
64-bit JVM. It can't load the aparapi_x86_64 library. I have a NVIDIA GTX 670 
card with the latest stable drivers.

It seems that the latest version that works for me is aparapi-2012-05-06. 
Release aparapi-2012-11-14 does not work, nor does aparapi-2012-12-02. So if 
2012-05-06 already requires OpenCL 1.2 then it can't be an OpenCL 1.2 thing, is 
that so?

The error message is:
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 
that both are in your PATH (windows) or in LD_LIBRARY_PATH (linux).

I haven't tried it with a 32-bit JVM (I don't have one installed; what would be 
the point when you have a 64-bit OS).

Original comment by mikkotom...@netscape.net on 11 Dec 2012 at 10:34

GoogleCodeExporter commented 9 years ago
So far it appears to only be NVIDIA GPUs on Windows, unfortunately. I have 
tried the latest Aparapi on my MacBook Pro with an NVIDIA GPU and everything 
appears to work.

Original comment by ryan.lam...@gmail.com on 11 Dec 2012 at 11:50

GoogleCodeExporter commented 9 years ago
I have two ideas.

1) I think I can get hold of an NVidia card tomorrow.  Hopefully I can 
recreated this and then debug

2) I would recommend someone observing this error, consider building their own 
aparapi_x86_64.dll.  This should be as simple as checking the svn trunk out and 
building using ant. Then validate if this still is an error.  You will of 
course need to have visual studio (express will work - the free one!) 

gary

Original comment by frost.g...@gmail.com on 13 Dec 2012 at 1:23

GoogleCodeExporter commented 9 years ago
Okay, so I was finally able to sit down on my MacBook Pro which has Lion 
(10.7.5), Oracle JDK 7 and NVIDIA GPU installed. I have built Aparapi Trunk 
from scratch and am now seeing similar, although not identical, behavior.

2012-11-14 Release: Test failed with the following exception resulting in a 
StackOverflowError:

!!!!!!! clEnqueueNDRangeKernel() failed invalid work group size
after clEnqueueNDRangeKernel, globalSize[0] = 128, localSize[0] = 16
after clEnqueueNDRangeKernel, globalSize[1] = 128, localSize[1] = 32
Dec 14, 2012 3:28:06 PM com.amd.aparapi.KernelRunner executeOpenCL
WARNING: ### CL exec seems to have failed. Trying to revert to Java ###

2012-12-02 Release: Test fails to load Aparapi JNI resulting in an 
UnsatisfiedLinkError on kernel.dispose():

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 
that both are in your PATH (windows) or in LD_LIBRARY_PATH (linux).

Original comment by ryan.lam...@gmail.com on 14 Dec 2012 at 11:39

GoogleCodeExporter commented 9 years ago
Trunk: Test fails to execute in GPU mode but successfully falls back to JTP 
mode without a StackOverflowError or UnsatisfiedLinkError:

!!!!!!! clEnqueueNDRangeKernel() failed invalid work group size
after clEnqueueNDRangeKernel, globalSize[0] = 128, localSize[0] = 16
after clEnqueueNDRangeKernel, globalSize[1] = 128, localSize[1] = 32
Dec 14, 2012 3:45:26 PM com.amd.aparapi.KernelRunner executeOpenCL
WARNING: ### CL exec seems to have failed. Trying to revert to Java ###

Original comment by ryan.lam...@gmail.com on 14 Dec 2012 at 11:47

GoogleCodeExporter commented 9 years ago
I built my own aparapi_x86_64.dll with Windows SDK 7.1, Visual C++ Express 2010 
and AMD APP SDK 2.8, from the trunk of the aparapi svn (just ran ant and it 
built me the aparapi dll and jar). I have an NVidia GPU. But the result is 
unchanged; it doesn't load the native library and just gives the same error:

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 
that both are in your PATH (windows) or in LD_LIBRARY_PATH (linux).

Original comment by mikkotom...@netscape.net on 17 Dec 2012 at 10:51

GoogleCodeExporter commented 9 years ago
Building against AMD APP SDK 2.8 and trying to run on NVidia card will recreate 
the problem. 

AMD APP SDK 2.8 is an OpenCL 1.2 SDK and has a 1.2 runtime (for AMD devices).  
From my understanding NVidia does not support 1.2. 

When we build against a 1.2 header/lib the dll needs to run against a 1.2 
version of OpenCL.  At runtime your NVidia OpenCL driver does not have the 1.2 
api's. So the OpenCL.dll library cannot load. 

You need to try to build against the NVidia headers and libraries. This will 
mean hacking the build.xml file in com.amd.aparapi.jni.

If anyone knows where the default NVidia headers/libraries are located.  You 
might just be able to edit build.xml.  Find the stanza that looks like 

   <available property="win64.amd.app.sdk.exists" file="C:/Program Files (x86)/AMD APP" type="dir"/>
      <condition property="amd.app.sdk.dir" value="C:/Program Files (x86)/AMD APP">
         <and>
            <os family="windows" />
            <isset property="win64.amd.app.sdk.exists" />
            <not>
               <isset property="win32.amd.app.sdk.exists" />
            </not>
         </and>
      </condition>

And point both file references to the root of the NVidia SDK (contains cl 
headers and libs) then rebuild. 

Let me see if I can easily remove the 1.2 APIs.  I think they were for 
profiling.  Maybe we can ditch them until NVidia gets a 1.2 runtime. 

Gary

Original comment by frost.g...@gmail.com on 17 Dec 2012 at 11:39

GoogleCodeExporter commented 9 years ago
BTW is this still a Mac Mini we are talking about.  Is this using something 
like parallels to virtualize windows?  Or is it native windows. 

?

Original comment by frost.g...@gmail.com on 17 Dec 2012 at 11:43

GoogleCodeExporter commented 9 years ago
mikkotommila, 

The attached patch will remove access to OpenCL 1.2 API's.  Try applying this 
to aparapi.cpp and rebuilding your dll. 

DO NOT TURN ON PROFILING! ;) 

Original comment by frost.g...@gmail.com on 17 Dec 2012 at 11:59

GoogleCodeExporter commented 9 years ago
Jepp, it is Mac Mini but with running Windows 7 via bootcamp. The only 
difference is that I have the newest nvidia drivers installed.

Original comment by hansbla...@googlemail.com on 17 Dec 2012 at 11:59

GoogleCodeExporter commented 9 years ago
O.K so bootcamp is running windows on hardware, there is no virtualization 
here. We are not expecting a virtualized Graphics driver to work here.

Gary

Original comment by frost.g...@gmail.com on 18 Dec 2012 at 12:01

GoogleCodeExporter commented 9 years ago
gary, regarding this OpenCl 1.2 Nvidia issue. It's right that Nvidia seems to 
only support OpenCl 1.1 at the moment. However, why does this error occur only 
on 64-bit dlls and not on 32-bit dlls?

Original comment by hansbla...@googlemail.com on 18 Dec 2012 at 7:00

GoogleCodeExporter commented 9 years ago
Hansblafoo (great handle by the way)

This is a good question.  Let me check the machine I built the 32 bit windows 
dll on.  Maybe it has not been upgraded to a later version of the SDK. 

Gary

Original comment by frost.g...@gmail.com on 18 Dec 2012 at 2:25

GoogleCodeExporter commented 9 years ago
I applied a patch (attached - really this time) and built a new Win 7 64 bit 
dll. This doe snot need any OpenCL 1.2 features so hopefully will load on 
machines with OpenCL 1.1 runtimes. 

http://code.google.com/p/aparapi/downloads/list

Can someone try this and see if it works. 

Original comment by frost.g...@gmail.com on 19 Dec 2012 at 8:05

Attachments:

GoogleCodeExporter commented 9 years ago
Hello, release aparapi-r904-opencl_1_1.zip does seem to work for me. Thanks!

However, what still seems a bit odd to me is that the last release that worked 
for me was aparapi-2012-05-06 and it already required OpenCL 1.2? And release 
aparapi-2012-11-14 did not work for me. So if that is accurate then it is not 
OpenCL 1.2 that is causing the problem but something else that happened between 
aparapi-2012-05-06 and aparapi-2012-11-14?

Also, I have an NVidia GTX 670, which at least according to the specs supports 
OpenCL 1.2. However I don't know about the NVidia opencl dll file, does it 
support everything in OpenCL 1.2 that aparapi needs.

Original comment by mikkotom...@netscape.net on 19 Dec 2012 at 11:04

GoogleCodeExporter commented 9 years ago
I did a bit of a binary search to find in which revision exactly the library 
stopped working for me. Apparently r555 works and r556 does not work. 
Incidentally, in r556 there is a change to aparapi.cpp that adds the 
clEnqueueMarkerWithWaitList() call if CL_VERSION_1_2 is defined. Which seems to 
be basically the same section of code that is fixed with the above patch.

Original comment by mikkotom...@netscape.net on 20 Dec 2012 at 7:19

GoogleCodeExporter commented 9 years ago
We were just bit with this bug today on a number of workstations that have 
NVIDIA GPUs and OpenCL 1.1.

Can we get a new Aparapi build pushed out ASAP with this NVIDIA patch?

Original comment by ryan.lam...@gmail.com on 17 Jan 2013 at 12:24

GoogleCodeExporter commented 9 years ago
Is this on Windows? 64 bit?

In which case the win7 64 bit build (only no mac or linux)  download should 
work.
https://code.google.com/p/aparapi/downloads/detail?name=aparapi-r904-opencl_1_1.
zip&can=2&q=#makechanges

Here is a link to the zip directly.
https://aparapi.googlecode.com/files/aparapi-r904-opencl_1_1.zip

Can you check this version?

Gary

Original comment by frost.g...@gmail.com on 17 Jan 2013 at 1:05

GoogleCodeExporter commented 9 years ago
I can try to test that download, we currently use Windows 7 64-bit for 
development, but our deployments require both 32-bit and 64-bit builds for 
Windows and Linux. Unfortunately, I do not have access to a 32-bit development 
machine, only the test machines once the project build is complete.

Original comment by ryan.lam...@gmail.com on 17 Jan 2013 at 5:53

GoogleCodeExporter commented 9 years ago
Can you test using this Win 64 bit first.  I have not heard back if this fixes 
the issue ;) if it does I will build a Win 32+64, Linux 32+64 and OSX 
distribution.

If the issue persists,clearly I need to debug some more 

BTW if this is a fix, it might not be until the weekend before I get to build a 
binary distribution. I have to do this at home (4 separate SSD's and my Mac 
Book Pro!) and it takes some time (and mind numbing!). 

Gary 

Original comment by frost.g...@gmail.com on 17 Jan 2013 at 7:54

GoogleCodeExporter commented 9 years ago
We tested the contents of your ZIP file on an NVIDIA OpenCL 1.1 machine running 
Windows 64-bit. Here are our results:

- The 12-02-2012 build of Aparapi fails to find a GPU using either 
Device.firstGPU() or Device.best() but still executes JTP correctly.

- The ZIP file also failed to find a GPU but core dumped the JVM upon trying to 
execute JTP.

Please see attached log output.

Original comment by ryan.lam...@gmail.com on 18 Jan 2013 at 2:30

Attachments:

GoogleCodeExporter commented 9 years ago
Windows 7 64-bit

Original comment by ryan.lam...@gmail.com on 18 Jan 2013 at 2:30

GoogleCodeExporter commented 9 years ago
I emailed you the log output directly

Original comment by ryan.lam...@gmail.com on 18 Jan 2013 at 2:33

GoogleCodeExporter commented 9 years ago
Yikes a core dump.  Thats not good. let me take a look at the dump.  Sorry 
about this. 

Original comment by frost.g...@gmail.com on 18 Jan 2013 at 2:38

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Ryan, 

I am unable to recreate this.  I think that issue #87  
http://code.google.com/p/aparapi/issues/detail?id=83 is identical (Linux + 
NVidia) with a hotspot log which points to Aparapi.cpp InitJNI().

Sadly I do not have an NVidia setup to help me debug. Are you in a position to 
take a look and debug?

Gary 

Original comment by frost.g...@gmail.com on 21 Jan 2013 at 4:22

GoogleCodeExporter commented 9 years ago
This has been resolved in the latest Aparapi build dated 2013-01-23.

Original comment by ryan.lam...@gmail.com on 27 Jan 2013 at 9:19