Syncleus / aparapi

The New Official Aparapi: a framework for executing native Java and Scala code on the GPU.
http://aparapi.com
Apache License 2.0
465 stars 59 forks source link

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

Open orvarehn opened 4 years ago

orvarehn commented 4 years ago

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

syncleus-bot commented 4 years ago

I should have time to look at this tomorrow. I'm out in the city today.

On Tue, Jul 16, 2019, 11:42 AM Orvar Ehn notifications@github.com wrote:

Related to #122 https://github.com/Syncleus/aparapi/issues/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 https://github.com/Syncleus/aparapi/issues/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); } } }

This crashes with: Jul 16, 2019 11:32:10 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 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

Process finished with exit code 0

Is this another bug? or how can I use the latest version with the bugfix in it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi/issues/148?email_source=notifications&email_token=AFRVQ3YXEK5TYYMLZ7ULPE3P7WJWPA5CNFSM4ID7BAXKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G7NRO3A, or mute the thread https://github.com/notifications/unsubscribe-auth/AFRVQ36GUX4KB7M56NM57WLP7WJWPANCNFSM4ID7BAXA .

jchan007 commented 4 years ago

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

freemo commented 4 years ago

This is quite odd as it does run for me on the latest on macOS... At least i think so. Let me try replicating this again my memory might be faulty.

On Fri, Jul 19, 2019 at 9:36 PM jchan007 notifications@github.com wrote:

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi/issues/148?email_source=notifications&email_token=AAXESAU4DGYA3L36OGUHL5LQAIJVXA5CNFSM4ID7BAXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2MR26Q#issuecomment-513351034, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXESAQWQXTQMEUAFNOARD3QAIJVXANCNFSM4ID7BAXA .

orvarehn commented 4 years ago

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

jchan007 commented 4 years ago

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!

bmatasar commented 4 years ago

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

bmatasar commented 4 years ago

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

freemo commented 4 years ago

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.

jchan007 commented 4 years ago

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>