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

Still can't run Aparapi v1.10.0 - v1.8.0 on Mac OSX (MacBook Pro 2x GPU).. but v1.7.0 works

orvarehn opened this issue · comments

Related to #122

Just trying out aparapi I ran the aparapi-examples .. and got the failing tests when trying to build v1.9.0 (and v1.8.0) .. since discovering #122 I tried v1.7.0 and (after turning of JavaDoc generation that for some reason failed) I can get the examples to run on my MacBook Pro.

So I thought that v1.10.0 had the bugfix for this issue and tried an example "devices in preferred order"

public class DeviceInfo {
    public static void main(String[] args) {
        KernelPreferences preferences = KernelManager.instance().getDefaultPreferences();
        System.out.println("-- Devices in preferred order --");
        for (Device device : preferences.getPreferredDevices(null)) {
            System.out.println("----------");
            System.out.println(device);
        }
    }
}

Jul 16, 2019 11:46:08 AM com.aparapi.internal.opencl.OpenCLLoader
SEVERE: Check your environment. Failed to load codegen native library or possibly failed to locate opencl native library (opencl.dll/opencl.so). Ensure that OpenCL is in your PATH (windows) or in LD_LIBRARY_PATH (linux).

But this works if I change to version 1.7.0

Devices in preferred order

Device 16925952
vendor = Apple
type:GPU
maxComputeUnits=24
maxWorkItemDimensions=3
maxWorkItemSizes={256, 256, 256}
maxWorkWorkGroupSize=256
globalMemSize=1610612736
localMemSize=65536

Device 16915456
vendor = Apple
type:GPU
maxComputeUnits=10
maxWorkItemDimensions=3
maxWorkItemSizes={256, 256, 256}
maxWorkWorkGroupSize=256
globalMemSize=2147483648
localMemSize=32768

Device 4294967295
vendor = Apple
type:CPU
maxComputeUnits=8
maxWorkItemDimensions=3
maxWorkItemSizes={1024, 1, 1}
maxWorkWorkGroupSize=1024
globalMemSize=17179869184
localMemSize=32768

Java Alternative Algorithm

Java Thread Pool

So is this another bug than #122 or how do I use the latest version with the bugfix?
I ran the example through Intellij IDEA ..

Regards

I had the same issues running on macOS 10.13 or 10.14 for any Aparapi versions greater than 1.7.0.

If it is any help this is my Macs hardware and graphics:
its macOS Mojave v10.14.5
And it apparently has 2xggr GPUs, could it be this that throws the newer versions of aparapi?
@jchan007 does your mac also have 2 GPUs?
@freemo Just let me know if there is anything I can do to help, I'm on summer vacation this and next week but after that I'm back to work and can answer quicker. :-)

Hardware Overview:

Model Name: MacBook Pro
Model Identifier: MacBookPro13,3
Processor Name: Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 6 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
Boot ROM Version: 256.0.0.0.0
SMC Version (system): 2.38f7
Serial Number (system): C02TH2FQGTDY
Hardware UUID: C9E38F86-96D3-56F8-BF5E-503248BFE0D4

Intel HD Graphics 530:

Chipset Model: Intel HD Graphics 530
Type: GPU
Bus: Built-In
VRAM (Dynamic, Max): 1536 MB
Vendor: Intel
Device ID: 0x191b
Revision ID: 0x0006
Automatic Graphics Switching: Supported
gMux Version: 4.0.29 [3.2.8]
Metal: Supported, feature set macOS GPUFamily2 v1
Displays:
Colour LCD:
Display Type: Built-In Retina LCD
Resolution: 2880x1800 Retina
Framebuffer Depth: 24-Bit Colour (ARGB8888)
Main Display: Yes
Mirror: Off
Online: Yes
Rotation: Supported
Automatically Adjust Brightness: No

Radeon Pro 450:

Chipset Model: AMD Radeon Pro 450
Type: GPU
Bus: PCIe
PCIe Lane Width: x8
VRAM (Total): 2 GB
Vendor: AMD (0x1002)
Device ID: 0x67ef
Revision ID: 0x00ef
ROM Revision: 113-C980AF-908
VBIOS Version: 113-C9801AL-028
EFI Driver Version: 01.A0.908
Automatic Graphics Switching: Supported
gMux Version: 4.0.29 [3.2.8]
Metal: Supported, feature set macOS GPUFamily2 v1

On macOS for aparapi 1.10.0 runtime UnsatisfiedLinkError with aparapi-jni 1.3.0, 1.3.1, 1.4.0, or 1.4.1, I found that using aparapi-jni 1.4.2-SNAPSHOT, resolved the issue!

Definitely there is an issue with the included dynamic lib.
java.lang.UnsatisfiedLinkError: /private/var/folders/lp/8y14zffn1950wmdv5hwjqmq40000gn/T/libaparapi_x86_649204007986505769813.dylib: dlopen(/private/var/folders/lp/8y14zffn1950wmdv5hwjqmq40000gn/T/libaparapi_x86_649204007986505769813.dylib, 1): no suitable image found. Did find: /private/var/folders/lp/8y14zffn1950wmdv5hwjqmq40000gn/T/libaparapi_x86_649204007986505769813.dylib: malformed mach-o image: load command #9 length (0) too small in /private/var/folders/lp/8y14zffn1950wmdv5hwjqmq40000gn/T/libaparapi_x86_649204007986505769813.dylib /private/var/folders/lp/8y14zffn1950wmdv5hwjqmq40000gn/T/libaparapi_x86_649204007986505769813.dylib: malformed mach-o image: load command #9 length (0) too small in /private/var/folders/lp/8y14zffn1950wmdv5hwjqmq40000gn/T/libaparapi_x86_649204007986505769813.dylib

Could you create the aparapi-jni 1.4.2 branch and update the pom for aparapi?
Thanks a lot!

Could you create the aparapi-jni 1.4.2 branch and update the pom for aparapi?
Thanks a lot!

I've been working on that the past few days actually. Trying to get clang compiler to work right now so very soon i hope.

While you're awaiting the aparapi-jni 1.4.2 branch update, this worked for me by updating the Maven pom.xml dependencies to use the aparapi-jni 1.4.2-SNAPSHOT for my project:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.aparapi</groupId>
        <artifactId>aparapi</artifactId>
        <version>1.10.0</version>
    </dependency>
    <dependency>
        <groupId>com.aparapi</groupId>
        <artifactId>aparapi-jni</artifactId>
        <version>1.4.2-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.apache.bcel</groupId>
        <artifactId>bcel</artifactId>
        <version>6.4.1</version>
    </dependency>
    <dependency>
        <groupId>org.scala-lang</groupId>
        <artifactId>scala-library</artifactId>
        <version>2.13.1</version>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-library</artifactId>
        <version>2.2</version>
    </dependency>
</dependencies>