Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JNI-based BLAS, LAPACK, and ARPACK implementations #1

Merged
merged 43 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
acdc066
v2-SNAPSHOT
luhenry Apr 26, 2021
eced8ea
Add JNI-based wrapper for BLAS
luhenry Apr 27, 2021
ef0a7b3
Print which implementation is currently running for benchmark
luhenry Apr 27, 2021
f7bc7e1
Add JDK17 profile, just in case.
luhenry Apr 27, 2021
676339b
Try JNIBLAS before ForeignLinkerBLAS
luhenry Apr 27, 2021
c46b546
Use Fortran symbols directly
luhenry Apr 28, 2021
2b8e251
Remove leftover debug comments
luhenry Apr 28, 2021
7e3300e
Rename dev.ludovic.netlib.blas.VectorizedBLAS to dev.ludovic.netlib.b…
luhenry Apr 28, 2021
f2eb51d
fixup! Rename dev.ludovic.netlib.blas.VectorizedBLAS to dev.ludovic.n…
luhenry Apr 28, 2021
ebeb566
Remove com.github.fommil from BLAS fully and WIP for LAPACK
luhenry Apr 27, 2021
6e230fd
Make sure critical JNI regions don't contain unecessary JNI calls
luhenry Apr 28, 2021
ea4672f
Do better error handling + Load org.netlib.util.*W types
luhenry Apr 28, 2021
d023607
Base implementation for LAPACK + Implement calls used by Spark
luhenry Apr 28, 2021
0d6cea6
Add native implementation for benchmarking JDK 8 and 11
luhenry Apr 28, 2021
f9cc171
Allow manual trigger of the workflow
luhenry Apr 28, 2021
7ab7051
Merge branch 'master' into jni-wrappers
luhenry Apr 28, 2021
9d2fc41
Relax the compiler warnings for now
luhenry Apr 28, 2021
e03e6e5
Fix installed dependencies
luhenry Apr 28, 2021
3eaf0d9
Implement some more BLAS calls in JNIBLAS
luhenry Apr 29, 2021
48fe143
Fix bound condition check
luhenry Apr 30, 2021
0b25182
Add code coverage information
luhenry Apr 30, 2021
f09c81f
Add scaffolding for JNIARPACK
luhenry Apr 30, 2021
96d15fe
Make sure license is consistent across all files
luhenry Apr 30, 2021
28d0d80
There might be cases where we want to make a release on a SNAPSHOT tag
luhenry Apr 30, 2021
4514d49
Add scaffolding for all ARPACK, BLAS, and LAPACK routines
luhenry Apr 30, 2021
c5eea70
Fix surefire:test
luhenry Apr 30, 2021
adab598
Add missing libarpack2-dev dependency on CI
luhenry Apr 30, 2021
7717097
Cache M2 repository to speed up CI
luhenry Apr 30, 2021
07c8a89
Relax caching across JDK versions
luhenry Apr 30, 2021
e72474b
Implement all BLAS routines for JNIBLAS
luhenry Apr 30, 2021
006f21c
Add generator for JNI
luhenry May 1, 2021
1cc5e62
Compiler complains that __ret may be uninitialized
luhenry May 2, 2021
44221fe
Generate function for NotImplemented + Reduce whitespace noise
luhenry May 2, 2021
768a473
Remove -Wno-unused-function and -Wno-unused-parameter warnings
luhenry May 2, 2021
9c29b6d
Generate the totality of jni.c for BLAS, ARPACK, and LAPACK
luhenry May 2, 2021
98e4284
Add null and index checks for double/float arrays
luhenry May 3, 2021
de18317
Cache more often
luhenry May 3, 2021
85c6e10
Use full name of library for dev.ludovic.netlib.{blas,lapack,arpack}.…
luhenry May 3, 2021
383a831
Skip unimplemented tests
luhenry May 3, 2021
74b43c7
Wrap calls to Objects.requireNonNull for consistency with checkIndex
luhenry May 3, 2021
c11fe1a
Add {BLAS,LAPACK,ARPACK}.getInstance helpers
luhenry May 3, 2021
f37fa20
Rename _*_offset parameters to offset*
luhenry May 3, 2021
2a960f9
Remove unused test resources and methods
luhenry May 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ jobs:
jdk: [8, 11, 16]
steps:
- uses: actions/checkout@v2
- name: Cache M2 local repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: m2
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install libopenblas-dev gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu
sudo apt-get -y install libopenblas-dev libarpack2-dev gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu
# Build with JDK 16
- name: Set up JDK 16
uses: actions/setup-java@v1
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
- '!v*-SNAPSHOT' # But not v*-SNAPSHOT, i.e. v2-SNAPSHOT
workflow_dispatch:

name: Release
Expand All @@ -21,10 +20,15 @@ jobs:
jdk: [8, 11, 16]
steps:
- uses: actions/checkout@v2
- name: Cache M2 local repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: m2
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install libopenblas-dev gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu
sudo apt-get -y install libopenblas-dev libarpack2-dev gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu
# Build with JDK 16
- name: Set up JDK 16
uses: actions/setup-java@v1
Expand All @@ -49,6 +53,15 @@ jobs:
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2
- name: Cache M2 local repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: m2
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu
- name: Set up JDK 16
uses: actions/setup-java@v1
with: # running setup-java again overwrites the settings.xml
Expand Down Expand Up @@ -85,7 +98,7 @@ jobs:
strategy:
matrix:
jdk: [8, 11, 16]
implementation: ["f2j", "java"]
implementation: ["f2j", "java", "native"]
filter: ["dev.ludovic.netlib.benchmarks.blas.l1", "dev.ludovic.netlib.benchmarks.blas.l2", "dev.ludovic.netlib.benchmarks.blas.l3"]
include:
- jdk: 16
Expand All @@ -100,18 +113,6 @@ jobs:
implementation: "java"
filter: "dev.ludovic.netlib.benchmarks.blas.l3"
jvmArgs: "--add-modules=jdk.incubator.vector"
- jdk: 16
implementation: "native"
filter: "dev.ludovic.netlib.benchmarks.blas.l1"
jvmArgs: "--add-modules=jdk.incubator.foreign -Dforeign.restricted=permit"
- jdk: 16
implementation: "native"
filter: "dev.ludovic.netlib.benchmarks.blas.l2"
jvmArgs: "--add-modules=jdk.incubator.foreign -Dforeign.restricted=permit"
- jdk: 16
implementation: "native"
filter: "dev.ludovic.netlib.benchmarks.blas.l3"
jvmArgs: "--add-modules=jdk.incubator.foreign -Dforeign.restricted=permit"
steps:
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v1
Expand Down
19 changes: 13 additions & 6 deletions arpack/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,24 @@ information or have any questions.
<parent>
<groupId>dev.ludovic.netlib</groupId>
<artifactId>parent</artifactId>
<version>1.3.2</version>
<version>2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>dev.ludovic.netlib</groupId>
<artifactId>arpack</artifactId>
<version>1.3.2</version>
<version>2-SNAPSHOT</version>
<packaging>jar</packaging>

<properties>
<junit.version>5.5.2</junit.version>
<netlib.java.version>1.1.2</netlib.java.version>
</properties>

<dependencies>
<dependency>
<groupId>com.github.fommil.netlib</groupId>
<artifactId>core</artifactId>
<version>${netlib.java.version}</version>
<groupId>net.sourceforge.f2j</groupId>
<artifactId>arpack_combined_all</artifactId>
<version>0.1</version>
</dependency>

<dependency>
Expand All @@ -64,4 +63,12 @@ information or have any questions.
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
12 changes: 12 additions & 0 deletions arpack/src/main/java/dev/ludovic/netlib/ARPACK.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,20 @@

package dev.ludovic.netlib;

import java.util.logging.Level;
import java.util.logging.Logger;

public interface ARPACK {

public static ARPACK getInstance() {
try {
return dev.ludovic.netlib.NativeARPACK.getInstance();
} catch (Throwable t) {
Logger.getLogger(ARPACK.class.getName()).warning("Failed to load implementation from:dev.ludovic.netlib.NativeARPACK");
}
return dev.ludovic.netlib.JavaARPACK.getInstance();
}

public void dmout(int lout, int m, int n, double[] a, int lda, int idigit, String ifmt);
public void dmout(int lout, int m, int n, double[] a, int offseta, int lda, int idigit, String ifmt);
public void smout(int lout, int m, int n, float[] a, int lda, int idigit, String ifmt);
Expand Down
2 changes: 1 addition & 1 deletion arpack/src/main/java/dev/ludovic/netlib/JavaARPACK.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
public interface JavaARPACK extends ARPACK {

public static JavaARPACK getInstance() {
return dev.ludovic.netlib.arpack.NetlibF2jARPACK.getInstance();
return dev.ludovic.netlib.arpack.F2jARPACK.getInstance();
}
}
4 changes: 2 additions & 2 deletions arpack/src/main/java/dev/ludovic/netlib/NativeARPACK.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public interface NativeARPACK extends ARPACK {

public static NativeARPACK getInstance() {
try {
return dev.ludovic.netlib.arpack.NetlibNativeARPACK.getInstance();
return dev.ludovic.netlib.arpack.JNIARPACK.getInstance();
} catch (Throwable t) {
Logger.getLogger(NativeARPACK.class.getName()).warning("Failed to load implementation from:dev.ludovic.netlib.arpack.NetlibNativeARPACK");
Logger.getLogger(NativeARPACK.class.getName()).warning("Failed to load implementation from:dev.ludovic.netlib.arpack.JNIARPACK");
}
throw new RuntimeException("Unable to load native implementation");
}
Expand Down
Loading