Compare commits
109 Commits
Author | SHA1 | Date |
---|---|---|
Brian Rosenberger | 035c196dfb | |
Brian Rosenberger | 1601a7189b | |
Brian Rosenberger | 927aa54563 | |
Brian Rosenberger | 06b1e4ab7a | |
Brian Rosenberger | acb098e8d7 | |
Brian Rosenberger | c37412cf34 | |
Brian Rosenberger | ae6f7f3e31 | |
Brian Rosenberger | 9740eb2566 | |
Brian Rosenberger | e2cbfacce5 | |
Brian Rosenberger | a1f5bba4ee | |
Brian Rosenberger | 9db53b96e1 | |
Brian Rosenberger | 5b6e37c721 | |
Brian Rosenberger | 94299b56be | |
Brian Rosenberger | 143b316755 | |
Brian Rosenberger | 91ce34cd77 | |
Brian Rosenberger | 8a98975252 | |
Brian Rosenberger | 235a8037ce | |
Brian Rosenberger | d5d7c5b6d3 | |
Brian Rosenberger | 0d0dc2755d | |
Brian Rosenberger | f8f9829308 | |
Brian Rosenberger | f9cef691fc | |
Brian Rosenberger | d8b6be8e66 | |
Brian Rosenberger | 6bb03b49a6 | |
Brian Rosenberger | 4e8a92b80f | |
Brian Rosenberger | 00128a11c2 | |
Brian Rosenberger | 8afae7a7f8 | |
Brian Rosenberger | 6f60f122cb | |
Brian Rosenberger | 8f0187c12d | |
Brian Rosenberger | d398ac64c8 | |
Brian Rosenberger | a2cc2c2263 | |
Brian Rosenberger | d28df16edf | |
Brian Rosenberger | 923b70edf8 | |
Brian Rosenberger | 5f2258b710 | |
Brian Rosenberger | d6dc72fc67 | |
Brian Rosenberger | 45933c6008 | |
Brian Rosenberger | 0d97ce3222 | |
Brian Rosenberger | d6a821b5e8 | |
Brian Rosenberger | 6509eaecf1 | |
Brian Rosenberger | 1575a27192 | |
Brian Rosenberger | 8e2f95c8fa | |
Brian Rosenberger | fad3057408 | |
Brian Rosenberger | aec8fb21ca | |
Brian Rosenberger | 8a303fe478 | |
Brian Rosenberger | df89eaf45a | |
Brian Rosenberger | 153d3fc674 | |
Brian Rosenberger | ab11499c76 | |
Brian Rosenberger | 33d855303b | |
Brian Rosenberger | 50eb2915bc | |
Brian Rosenberger | 1090aed6a2 | |
Brian Rosenberger | 87485c2d37 | |
Brian Rosenberger | 67d14b7ea8 | |
Brian Rosenberger | d44ddcacba | |
Brian Rosenberger | 1438c1fdae | |
Brian Rosenberger | 17c2306701 | |
Brian Rosenberger | 7b48bf1afb | |
Brian Rosenberger | 94da6843cd | |
Brian Rosenberger | 4793864178 | |
Brian Rosenberger | cefc2b9ea1 | |
Brian Rosenberger | 48ec7311bb | |
Brian Rosenberger | fd4a00e050 | |
Brian Rosenberger | 6256061378 | |
Brian Rosenberger | 1ff151d89a | |
Brian Rosenberger | 57f493f245 | |
Brian Rosenberger | 9d1fb9a279 | |
Brian Rosenberger | 7b73b05002 | |
Brian Rosenberger | 3e123cb4b8 | |
Brian Rosenberger | faa8ee5bc4 | |
Brian Rosenberger | 68e778bed0 | |
Brian Rosenberger | cbffab0a26 | |
Brian Rosenberger | 0525ea8f06 | |
Brian Rosenberger | 47771d5509 | |
Brian Rosenberger | 7edbe140ea | |
Brian Rosenberger | 48f20f1f27 | |
Brian Rosenberger | 54efcb8d47 | |
Brian Rosenberger | 667000df5b | |
Brian Rosenberger | 4d582263f0 | |
Brian Rosenberger | 3d29f98246 | |
Brian Rosenberger | dc2917857b | |
Brian Rosenberger | 97bcda699d | |
Brian Rosenberger | 0eb56ef45f | |
Brian Rosenberger | 2c0c3d01a0 | |
Brian Rosenberger | 43abd20b91 | |
Brian Rosenberger | 16e2e727e0 | |
Brian Rosenberger | c29d7172d3 | |
Brian Rosenberger | 97bf5b9baa | |
Brian Rosenberger | 1553f6ec78 | |
Brian Rosenberger | 6ef841e882 | |
Brian Rosenberger | 0d06e739ed | |
Brian Rosenberger | 150133602b | |
Brian Rosenberger | a63bee1b94 | |
Brian Rosenberger | 242cda372c | |
Brian Rosenberger | 3463b81d37 | |
Brian Rosenberger | d5eda7d4de | |
Brian Rosenberger | b33f5ea960 | |
Brian Rosenberger | ace9f74c31 | |
Brian Rosenberger | 9f1611609f | |
Brian Rosenberger | 4e4265c5c9 | |
Brian Rosenberger | ccba08e03f | |
Brian Rosenberger | 6e3fef4eb2 | |
Brian Rosenberger | 289305775c | |
Brian Rosenberger | cdd7eff0cf | |
Brian Rosenberger | 6da3d34fea | |
Brian Rosenberger | 796e3a6be0 | |
Brian Rosenberger | 9aa56f27f1 | |
Brian Rosenberger | 1dd926f8ec | |
Brian Rosenberger | 73d82f2b3a | |
Brian Rosenberger | b0b19107ed | |
Brian Rosenberger | 500a31d051 | |
Brian Rosenberger | 460ff4720d |
|
@ -1,15 +1,37 @@
|
|||
FROM nvidia/cuda:12.1.0-cudnn8-devel-ubuntu22.04
|
||||
FROM nvidia/cuda:12.2.0-devel-ubuntu20.04
|
||||
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-11-jdk wget build-essential checkinstall zlib1g-dev libssl-dev git
|
||||
#Build cmake version from source \
|
||||
ENV OS=ubuntu2004
|
||||
ENV cudnn_version=8.9.4.25
|
||||
ENV cuda_version=cuda12.2
|
||||
ENV CMAKE_VER=3.27.4
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wget software-properties-common
|
||||
|
||||
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
|
||||
|
||||
RUN mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600
|
||||
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/7fa2af80.pub
|
||||
RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/ /"
|
||||
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-11-jdk \
|
||||
build-essential checkinstall zlib1g-dev libssl-dev git libpthread-stubs0-dev \
|
||||
libcudnn8=${cudnn_version}-1+${cuda_version} libcudnn8-dev=${cudnn_version}-1+${cuda_version} \
|
||||
cuda-drivers
|
||||
|
||||
|
||||
#RUN apt-get install libcudnn8-samples=${cudnn_version}-1+${cuda_version}
|
||||
#Build cmake version from source \
|
||||
#RUN wget https://github.com/Kitware/CMake/releases/download/v3.24.2/cmake-3.24.2.tar.gz && \
|
||||
# tar -xvf cmake-3.24.2.tar.gz && cd cmake-3.24.2 && \
|
||||
# ./bootstrap && make && make install
|
||||
RUN wget -nv https://github.com/Kitware/CMake/releases/download/v3.24.2/cmake-3.24.2-linux-x86_64.sh && \
|
||||
mkdir /opt/cmake && sh ./cmake-3.24.2-linux-x86_64.sh --skip-license --prefix=/opt/cmake && ln -s /opt/cmake/bin/cmake /usr/bin/cmake && \
|
||||
rm cmake-3.24.2-linux-x86_64.sh
|
||||
RUN wget -nv https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-x86_64.sh && \
|
||||
mkdir -p /opt/cmake && sh ./cmake-${CMAKE_VER}-linux-x86_64.sh --skip-license --prefix=/opt/cmake && ln -s /opt/cmake/bin/cmake /usr/bin/cmake && \
|
||||
rm cmake-${CMAKE_VER}-linux-x86_64.sh
|
||||
RUN ln -s /usr/bin/make /usr/bin/gmake
|
||||
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" >> /etc/resolv.conf
|
||||
#RUN echo "nameserver 8.8.8.8" >> /etc/resolv.conf
|
||||
#RUN echo "nameserver 9.9.9.9" >> /etc/resolv.conf
|
||||
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
env:
|
||||
OS: windows
|
||||
cudnn_version: 8.9.4.25
|
||||
cuda_version: cuda12.2
|
||||
CMAKE_VER: 3.27.4
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: windows
|
||||
#container:
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: UCRT64
|
||||
update: true
|
||||
install: git tar gzip mingw-w64-ucrt-x86_64-gcc
|
||||
|
||||
# - run: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
|
||||
# - name: Check for CUDA
|
||||
# run: |
|
||||
# echo "Path: $env:PATH"
|
||||
|
||||
# - name: Install CUDA
|
||||
# uses: Jimver/cuda-toolkit@v0.2.11
|
||||
# id: cuda-toolkit
|
||||
# with:
|
||||
# cuda: '12.2.0'
|
||||
# - run: nvcc -V
|
||||
|
||||
- name: Install CMake and Ninja
|
||||
uses: lukka/get-cmake@dev/fix91
|
||||
with:
|
||||
useLocalCache: false
|
||||
useCloudCache: false
|
||||
#cmakeVersion: "~3.27.0"
|
||||
cmakeVersion: latest
|
||||
ninjaVersion: latest
|
||||
|
||||
- name: Execute Gradle build
|
||||
run: |
|
||||
cmd.exe /C ./gradlew.bat build \
|
||||
--stacktrace \
|
||||
-Pmavenuser=${{ secrets.MAVENUSER }} \
|
||||
-Pmavenpass=${{ secrets.MAVENPASS }} \
|
||||
-PossrhUsername=${{ secrets.OSSRHUSERNAME }} \
|
||||
-PossrhPassword=${{ secrets.OSSRHPASSWORD }} \
|
||||
-PCAVIS_CHIP=cpu,cuda -Pskip-native=false \
|
||||
>buildlog.txt 2>&1
|
||||
|
||||
- name: Upload log
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success() || failure() # run this step even if previous step failed
|
||||
with:
|
||||
name: Build-Log
|
||||
path: buildlog.txt
|
||||
|
||||
- run: echo "This job's status is ${{ job.status }}."
|
|
@ -0,0 +1,79 @@
|
|||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
env:
|
||||
OS: ubuntu2004
|
||||
cudnn_version: 8.9.4.25
|
||||
cuda_version: cuda12.2
|
||||
CMAKE_VER: 3.27.4
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-20.04:docker://nvidia/cuda:12.2.0-devel-ubuntu20.04
|
||||
steps:
|
||||
- run: echo "The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo "This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo "The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v3
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
|
||||
- name: Update initial docker image with apt-get
|
||||
run: |
|
||||
apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y wget software-properties-common && \
|
||||
|
||||
wget https://developer.download.nvidia.com/compute/cuda/repos/$OS/x86_64/cuda-$OS.pin && \
|
||||
mv cuda-$OS.pin /etc/apt/preferences.d/cuda-repository-pin-600 && \
|
||||
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$OS/x86_64/7fa2af80.pub && \
|
||||
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/$OS/x86_64/3bf863cc.pub && \
|
||||
add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/$OS/x86_64/ /" && \
|
||||
|
||||
apt-get -qq update && apt-get -qq upgrade -y && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \
|
||||
build-essential checkinstall zlib1g-dev libssl-dev git libpthread-stubs0-dev \
|
||||
libcudnn8=$cudnn_version-1+$cuda_version libcudnn8-dev=$cudnn_version-1+$cuda_version \
|
||||
libblas{3,-dev} liblapack{3,-dev} libatlas-base-dev libopenblas-dev && \
|
||||
wget -q https://developer.download.nvidia.com/compute/cuda/12.2.1/local_installers/cuda_12.2.1_535.86.10_linux.run && \
|
||||
sh cuda_12.2.1_535.86.10_linux.run --silent --toolkit
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||
java-version: '11'
|
||||
cache: 'gradle'
|
||||
|
||||
- name: Install CMake and Ninja
|
||||
uses: lukka/get-cmake@latest
|
||||
with:
|
||||
useLocalCache: true
|
||||
useCloudCache: false
|
||||
cmakeVersion: "~3.27.0"
|
||||
ninjaVersion: latest
|
||||
|
||||
- name: Execute Gradle build
|
||||
run: |
|
||||
sh ./gradlew build \
|
||||
--stacktrace \
|
||||
-Pmavenuser=${{ secrets.MAVENUSER }} \
|
||||
-Pmavenpass=${{ secrets.MAVENPASS }} \
|
||||
-PossrhUsername=${{ secrets.OSSRHUSERNAME }} \
|
||||
-PossrhPassword=${{ secrets.OSSRHPASSWORD }} \
|
||||
-PCAVIS_CHIP=cpu,cuda -Pskip-native=false \
|
||||
>buildlog.log 2>&1
|
||||
|
||||
- name: Upload log
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success() || failure() # run this step even if previous step failed
|
||||
with:
|
||||
name: my-artifact
|
||||
path: buildlog.log
|
||||
|
||||
- run: echo "This job's status is ${{ job.status }}."
|
|
@ -96,3 +96,4 @@ bruai4j-native-common/cmake*
|
|||
/cavis-dnn/cavis-dnn-core/build/resources/test/logback-test.xml
|
||||
/cavis-dnn/cavis-dnn-core/build/test-results/cudaTest/TEST-org.deeplearning4j.gradientcheck.AttentionLayerTest.xml
|
||||
/cavis-dnn/cavis-dnn-core/build/tmp/jar/MANIFEST.MF
|
||||
/.metadata/
|
||||
|
|
|
@ -26,7 +26,7 @@ pipeline {
|
|||
dir '.docker'
|
||||
label 'linux && docker && cuda'
|
||||
//additionalBuildArgs '--build-arg version=1.0.2'
|
||||
//args '--gpus all' --needed for test only, you can build without GPU
|
||||
//args '--gpus all' //--needed for test only, you can build without GPU
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,19 +57,31 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('test-linux-cuda') {
|
||||
/* agent {
|
||||
dockerfile {
|
||||
filename 'Dockerfile'
|
||||
dir '.docker'
|
||||
label 'linux && docker && cuda && cudart'
|
||||
//additionalBuildArgs '--build-arg version=1.0.2'
|
||||
args '--gpus all' //--needed for test only, you can build without GPU
|
||||
}
|
||||
}
|
||||
*/
|
||||
environment {
|
||||
MAVEN = credentials('Internal_Archiva')
|
||||
OSSRH = credentials('OSSRH')
|
||||
}
|
||||
|
||||
steps {
|
||||
steps {/*
|
||||
withGradle {
|
||||
sh 'sh ./gradlew test --stacktrace -PexcludeTests=\'long-running,performance\' -Pskip-native=true -PCAVIS_CHIP=cuda \
|
||||
-Pmavenuser=$MAVEN_USR -Pmavenpass=$MAVEN_PSW \
|
||||
-PossrhUsername=$OSSRH_USR -PossrhPassword=$OSSRH_PSW'
|
||||
}
|
||||
//stash includes: '/cavis-native/cavis-native-lib/build/lib/*.jar', name: 'cuda-build'
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.nd4j.nativeblas;
|
||||
package net.brutex.ai;
|
||||
|
||||
public class Dummy {
|
||||
public class LoaderTest {
|
||||
|
||||
public static void main(String[] args){
|
||||
System.load("C:\\Users\\brian\\_projects\\deeplearning4j\\cavis-native\\cavis-native-lib"
|
||||
+ "\\build\\generated\\sources\\javacpp\\cuda\\windows-x86_64-avx2\\jnind4jcuda.dll");
|
||||
}
|
||||
}
|
|
@ -22,7 +22,9 @@
|
|||
package net.brutex.ai.nd4j.tests;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bytedeco.javacpp.Loader;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nd4j.linalg.api.environment.Nd4jEnvironment;
|
||||
import org.nd4j.linalg.api.ndarray.INDArray;
|
||||
import org.nd4j.linalg.factory.Nd4j;
|
||||
|
||||
|
@ -37,12 +39,7 @@ public class LoadBackendTests {
|
|||
|
||||
@Test
|
||||
public void loadBackend() throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
|
||||
// check if Nd4j is there
|
||||
//Logger.getLogger(LoadBackendTests.class.getName()).info("System java.library.path: " + System.getProperty("java.library.path"));
|
||||
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
|
||||
sysPathsField.setAccessible(true);
|
||||
sysPathsField.set(null, null);
|
||||
//System.loadLibrary("jnind4jcpu");
|
||||
log.info("get number of GPUs {}", Nd4jEnvironment.getEnvironment().getNumGpus());
|
||||
log.info("Backend: {}", Nd4j.getBackend().buildInfo());
|
||||
double d1 = 2.0;
|
||||
double d2 = 5.0;
|
||||
|
@ -52,4 +49,10 @@ public class LoadBackendTests {
|
|||
Number n = res.sumNumber();
|
||||
assertEquals(n.doubleValue(), 7.0, String.format("Addition of two scalar values %g and %g", d1, d2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadCudaDLL() {
|
||||
System.load(
|
||||
"C:\\Users\\brian\\_projects\\deeplearning4j\\cavis-native\\cavis-native-lib\\build\\generated\\sources\\javacpp\\cuda\\windows-x86_64-avx2\\jnind4jcuda.dll");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ buildscript {
|
|||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.6.0"
|
||||
classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.8.0"
|
||||
classpath 'com.google.gradle:osdetector-gradle-plugin:1.7.0'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ dependencies {
|
|||
|
||||
|
||||
constraints {
|
||||
api enforcedPlatform("io.netty:netty-bom:${netty.version}")
|
||||
api enforcedPlatform("com.fasterxml.jackson:jackson-bom:${jackson.version}")
|
||||
api enforcedPlatform("com.squareup.okhttp3:okhttp-bom:${okhttp3.version}")
|
||||
api ("io.netty:netty-bom:${netty.version}")
|
||||
api ("com.fasterxml.jackson:jackson-bom:${jackson.version}")
|
||||
api ("com.squareup.okhttp3:okhttp-bom:${okhttp3.version}")
|
||||
|
||||
api 'com.google.guava:guava:30.1-jre'
|
||||
api "com.google.protobuf:protobuf-java:3.15.6"
|
||||
|
@ -105,18 +105,19 @@ dependencies {
|
|||
api "org.bytedeco:javacv:${javacv.version}"
|
||||
api "org.bytedeco:opencv:${opencv.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:openblas:${openblas.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:openblas-platform:${openblas.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:leptonica-platform:${leptonica.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:hdf5-platform:${hdf5.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:hdf5:${hdf5.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:hdf5:${hdf5.version}-${javacpp.presetsVersion}:${javacppPlatform}"
|
||||
|
||||
api "org.bytedeco:cuda:${cuda.version}-${cudnn.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:cuda-platform-redist:${cuda.version}-${cudnn.version}-${javacpp.presetsVersion}"
|
||||
//api "org.bytedeco:cuda-platform-redist:${cuda.version}-${cudnn.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:mkl:${mkl.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:tensorflow:${tensorflow.version}-1.5.8" //not available for javacpp 1.5.9 ?
|
||||
api "org.bytedeco:tensorflow-platform:${tensorflow.version}-1.5.8"
|
||||
api "org.bytedeco:tensorflow-lite:${tensorflow_lite.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:tensorflow-lite-platform:${tensorflow_lite.version}-${javacpp.presetsVersion}"
|
||||
//api "org.bytedeco:tensorflow:${tensorflow.version}-1.5.8" //not available for javacpp 1.5.9 ?
|
||||
//api "org.bytedeco:tensorflow-platform:${tensorflow.version}-1.5.8"
|
||||
//api "org.bytedeco:tensorflow-lite:${tensorflow_lite.version}-${javacpp.presetsVersion}"
|
||||
//api "org.bytedeco:tensorflow-lite-platform:${tensorflow_lite.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:tensorrt:${tensorrt.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:tensorrt-platform:${tensorrt.version}-${javacpp.presetsVersion}"
|
||||
api "org.bytedeco:cpython:${cpython.version}-${javacpp.presetsVersion}:${javacppPlatform}"
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
plugins {
|
||||
id 'java-library'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation platform(projects.cavisCommonPlatform)
|
||||
implementation projects.cavisNative.cavisNativeBlas
|
||||
implementation "org.bytedeco:javacpp"
|
||||
implementation group: "org.bytedeco", name: 'openblas-platform'
|
||||
}
|
|
@ -19,5 +19,4 @@
|
|||
#
|
||||
#
|
||||
|
||||
#org.nd4j.linalg.jcublas.JCublasBackend
|
||||
org.nd4j.linalg.cpu.nativecpu.CpuBackend
|
|
@ -13,7 +13,7 @@ dependencies {
|
|||
implementation projects.cavisNative.cavisNativeCommon
|
||||
implementation projects.cavisDnn.cavisDnnApi
|
||||
implementation projects.cavisDnn.cavisDnnCommon
|
||||
|
||||
implementation projects.cavisNative.cavisNativeCpuPresets
|
||||
|
||||
implementation (projects.cavisNative.cavisNativeLib) {
|
||||
capabilities {
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
plugins {
|
||||
id 'java-library'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation platform(projects.cavisCommonPlatform)
|
||||
implementation projects.cavisNative.cavisNativeBlas
|
||||
implementation "org.bytedeco:javacpp"
|
||||
}
|
|
@ -37,7 +37,10 @@ import java.util.List;
|
|||
* @author saudet
|
||||
*/
|
||||
@Properties(target = "org.nd4j.nativeblas.Nd4jCuda", helper = "org.nd4j.nativeblas.cuda.Nd4jCudaHelper",
|
||||
value = {@Platform(define = "LIBND4J_ALL_OPS", include = {
|
||||
value = {
|
||||
@Platform(
|
||||
define = "LIBND4J_ALL_OPS",
|
||||
include = {
|
||||
"array/DataType.h",
|
||||
"array/DataBuffer.h",
|
||||
"array/PointerDeallocator.h",
|
||||
|
@ -105,7 +108,7 @@ import java.util.List;
|
|||
"ops/declarable/CustomOperations.h",
|
||||
"build_info.h",
|
||||
},
|
||||
exclude = {"ops/declarable/headers/activations.h",
|
||||
exclude = {"ops/declarable/headers/activations.h",
|
||||
"ops/declarable/headers/boolean.h",
|
||||
"ops/declarable/headers/broadcastable.h",
|
||||
"ops/declarable/headers/convo.h",
|
||||
|
@ -125,12 +128,16 @@ import java.util.List;
|
|||
"cnpy/cnpy.h"
|
||||
},
|
||||
compiler = {"cpp11", "nowarnings"},
|
||||
library = "jnind4jcuda", link = "nd4jcuda", preload = "nd4jcuda"),
|
||||
@Platform(value = "linux", preload = "gomp@.1", preloadpath = {"/lib64/", "/lib/", "/usr/lib64/", "/usr/lib/"}),
|
||||
library = "jnind4jcuda",
|
||||
link = {"nd4jcuda"}),
|
||||
//preload = "nd4jcuda"),
|
||||
|
||||
@Platform(value = "linux", preload = "gomp@.1", preloadpath = {"/lib64/", "/lib/", "/usr/lib64/", "/usr/lib/", "/usr/local/cuda/lib64"}),
|
||||
@Platform(value = "linux-armhf", preloadpath = {"/usr/arm-linux-gnueabihf/lib/", "/usr/lib/arm-linux-gnueabihf/"}),
|
||||
@Platform(value = "linux-arm64", preloadpath = {"/usr/aarch64-linux-gnu/lib/", "/usr/lib/aarch64-linux-gnu/"}),
|
||||
@Platform(value = "linux-ppc64", preloadpath = {"/usr/powerpc64-linux-gnu/lib/", "/usr/powerpc64le-linux-gnu/lib/", "/usr/lib/powerpc64-linux-gnu/", "/usr/lib/powerpc64le-linux-gnu/"}),
|
||||
@Platform(value = "windows", preload = {"libwinpthread-1", "libgcc_s_seh-1", "libgomp-1", "libstdc++-6", "nd4jcuda"}) })
|
||||
@Platform(value = "windows", preload = {"libwinpthread-1", "libgcc_s_seh-1", "libgomp-1", "libstdc++-6"})
|
||||
})
|
||||
public class Nd4jCudaPresets implements LoadEnabled, InfoMapper {
|
||||
|
||||
@Override public void init(ClassProperties properties) {
|
||||
|
@ -143,14 +150,19 @@ public class Nd4jCudaPresets implements LoadEnabled, InfoMapper {
|
|||
return;
|
||||
}
|
||||
int i = 0;
|
||||
/*
|
||||
String[] libs = {"cudart", "cublasLt", "cublas", "curand", "cusolver", "cusparse", "cudnn",
|
||||
"cudnn_ops_infer", "cudnn_ops_train", "cudnn_adv_infer",
|
||||
"cudnn_adv_train", "cudnn_cnn_infer", "cudnn_cnn_train"};
|
||||
|
||||
*/
|
||||
// test no preload
|
||||
String[] libs = {};
|
||||
for (String lib : libs) {
|
||||
if (platform.startsWith("linux")) {
|
||||
lib += lib.startsWith("cudnn") ? "@.8" : lib.equals("curand") ? "@.10" : lib.equals("cudart") ? "@.11.0" : "@.11";
|
||||
lib += lib.startsWith("cudnn") ? "@.8" : lib.equals("curand") ? "@.10" : lib.equals("cufft") ? "@.11" : "@.12";
|
||||
} else if (platform.startsWith("windows")) {
|
||||
lib += lib.startsWith("cudnn") ? "64_8" : lib.equals("curand") ? "64_10" : lib.equals("cudart") ? "64_110" : "64_11";
|
||||
lib += lib.startsWith("cudnn") ? "64_8" : lib.equals("cufft") ? "64_11" : lib.equals("cusolver") ? "64_11" : lib.equals("curand") ? "64_10" : "64_12";
|
||||
} else {
|
||||
continue; // no CUDA
|
||||
}
|
||||
|
@ -158,9 +170,9 @@ public class Nd4jCudaPresets implements LoadEnabled, InfoMapper {
|
|||
preloads.add(i++, lib);
|
||||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
//if (i > 0) {
|
||||
resources.add("/org/bytedeco/cuda/");
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
#
|
||||
# ******************************************************************************
|
||||
# *
|
||||
# * This program and the accompanying materials are made available under the
|
||||
# * terms of the Apache License, Version 2.0 which is available at
|
||||
# * https://www.apache.org/licenses/LICENSE-2.0.
|
||||
# *
|
||||
# * See the NOTICE file distributed with this work for additional
|
||||
# * information regarding copyright ownership.
|
||||
# * Unless required by applicable law or agreed to in writing, software
|
||||
# * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# * License for the specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# *
|
||||
# * SPDX-License-Identifier: Apache-2.0
|
||||
# *****************************************************************************
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
org.nd4j.linalg.cpu.nativecpu.compression.CpuThreshold
|
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
#
|
||||
# ******************************************************************************
|
||||
# *
|
||||
# * This program and the accompanying materials are made available under the
|
||||
# * terms of the Apache License, Version 2.0 which is available at
|
||||
# * https://www.apache.org/licenses/LICENSE-2.0.
|
||||
# *
|
||||
# * See the NOTICE file distributed with this work for additional
|
||||
# * information regarding copyright ownership.
|
||||
# * Unless required by applicable law or agreed to in writing, software
|
||||
# * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# * License for the specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# *
|
||||
# * SPDX-License-Identifier: Apache-2.0
|
||||
# *****************************************************************************
|
||||
#
|
||||
#
|
||||
|
||||
org.nd4j.linalg.jcublas.JCublasBackend
|
||||
#org.nd4j.linalg.cpu.nativecpu.CpuBackend
|
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# /* ******************************************************************************
|
||||
# *
|
||||
# *
|
||||
# * This program and the accompanying materials are made available under the
|
||||
# * terms of the Apache License, Version 2.0 which is available at
|
||||
# * https://www.apache.org/licenses/LICENSE-2.0.
|
||||
# *
|
||||
# * See the NOTICE file distributed with this work for additional
|
||||
# * information regarding copyright ownership.
|
||||
# * Unless required by applicable law or agreed to in writing, software
|
||||
# * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# * License for the specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# *
|
||||
# * SPDX-License-Identifier: Apache-2.0
|
||||
# ******************************************************************************/
|
||||
#
|
||||
|
||||
iamax_strided = 1
|
|
@ -0,0 +1,22 @@
|
|||
#
|
||||
# /* ******************************************************************************
|
||||
# *
|
||||
# *
|
||||
# * This program and the accompanying materials are made available under the
|
||||
# * terms of the Apache License, Version 2.0 which is available at
|
||||
# * https://www.apache.org/licenses/LICENSE-2.0.
|
||||
# *
|
||||
# * See the NOTICE file distributed with this work for additional
|
||||
# * information regarding copyright ownership.
|
||||
# * Unless required by applicable law or agreed to in writing, software
|
||||
# * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# * License for the specific language governing permissions and limitations
|
||||
# * under the License.
|
||||
# *
|
||||
# * SPDX-License-Identifier: Apache-2.0
|
||||
# ******************************************************************************/
|
||||
#
|
||||
|
||||
org.nd4j.linalg.api.resources.maxallocated= 2000000000
|
||||
org.nd4j.linalg.api.resources.memoryratio=0.5
|
|
@ -10,22 +10,22 @@ ext {
|
|||
|
||||
dependencies {
|
||||
implementation platform(projects.cavisCommonPlatform)
|
||||
|
||||
//implementation project(":cavis-native:cavis-native-blas")
|
||||
implementation projects.cavisNative.cavisNativeBlas
|
||||
|
||||
implementation group: "org.bytedeco", name: "cuda"
|
||||
implementation group: "org.bytedeco", name: "cuda", classifier: buildTarget
|
||||
implementation group: "org.bytedeco", name: "cuda", classifier: "${buildTarget}-redist"
|
||||
//implementation group: "org.bytedeco", name: "cuda", classifier: "${buildTarget}-redist"
|
||||
|
||||
implementation group: "org.bytedeco", name: "javacpp"
|
||||
implementation group: "org.bytedeco", name: "javacpp", classifier: buildTarget
|
||||
|
||||
implementation(project(path: ":cavis-native:cavis-native-lib")) {
|
||||
implementation projects.cavisNative.cavisNativeCudaPresets
|
||||
implementation(project(":cavis-native:cavis-native-lib")) {
|
||||
capabilities {
|
||||
it.requireCapability(group: "net.brutex.cavis.cavis-native", name: "cavis-native-lib-cuda-support", version:project.version)
|
||||
requireCapability("${project.group}:cavis-native-lib-cuda-support:${project.version}")
|
||||
}
|
||||
}
|
||||
|
||||
implementation project(":cavis-native:cavis-native-common")
|
||||
implementation project(":cavis-dnn:cavis-dnn-api")
|
||||
implementation project(":cavis-dnn:cavis-dnn-common")
|
||||
|
@ -36,3 +36,9 @@ dependencies {
|
|||
implementation "org.apache.commons:commons-lang3"
|
||||
}
|
||||
|
||||
tasks.named("compileJava").configure {
|
||||
dependsOn ":cavis-native:cavis-native-lib:javacppCudaSupportBuildParser",
|
||||
":cavis-native:cavis-native-lib:cudaJar"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
package org.nd4j.jita.constant;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nd4j.linalg.api.buffer.DataBuffer;
|
||||
import org.nd4j.linalg.api.buffer.DataType;
|
||||
|
|
|
@ -3,13 +3,14 @@ cmake_minimum_required(VERSION 3.20)
|
|||
|
||||
project(libnd4j)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
|
||||
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
message("CMAKE MODULE PATH IS ${CMAKE_MODULE_PATH}")
|
||||
|
||||
#ensure we create lib files
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
|
||||
#set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
|
||||
|
||||
|
||||
option(SD_NATIVE "Optimize for build machine (might not work on others)" OFF)
|
||||
|
@ -25,6 +26,12 @@ set(FLATBUFFERS_BUILD_FLATC "OFF" CACHE STRING "Hack to disable flatc build" FOR
|
|||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# MSVC runtime lib can be either "MultiThreaded" or "MultiThreadedDLL", /MT and /MD respectively
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
||||
|
||||
#///////////////////////////////////////////////////////////////////////////////
|
||||
# genCompilation: Generates cpp, cu files
|
||||
# INPUT:
|
||||
|
@ -120,8 +127,8 @@ endfunction()
|
|||
|
||||
|
||||
if (SD_CUDA)
|
||||
#enable_language(CUDA)
|
||||
find_package(CUDAToolkit 11.4 REQUIRED)
|
||||
find_package(CUDAToolkit 12.2 REQUIRED)
|
||||
enable_language(CUDA)
|
||||
message(STATUS "CUDAToolkit_VERSION: ${CUDAToolkit_VERSION}")
|
||||
message(STATUS "CUDAToolkit_VERSION_MAJOR: ${CUDAToolkit_VERSION_MAJOR}")
|
||||
message(STATUS "CUDAToolkit_VERSION_MINOR: ${CUDAToolkit_VERSION_MINOR}")
|
||||
|
@ -136,8 +143,7 @@ else()
|
|||
set(DEFAULT_ENGINE "samediff::ENGINE_CPU")
|
||||
endif()
|
||||
|
||||
# MSVC runtime lib can be either "MultiThreaded" or "MultiThreadedDLL", /MT and /MD respectively
|
||||
#set(MSVC_RT_LIB "MultiThreadedDLL")
|
||||
|
||||
|
||||
set(SD_X86_BUILD false)
|
||||
|
||||
|
@ -155,10 +161,10 @@ elseif (APPLE)
|
|||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fPIC -Wno-braced-scalar-init -Wno-delete-non-virtual-dtor -Wno-unused-command-line-argument -Wno-dangling-else -D__APPLE_OS__=true -D_RELEASE=true")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG " -O0 -g -fPIC -Wno-braced-scalar-init -Wno-delete-non-virtual-dtor -Wno-unused-command-line-argument -Wno-dangling-else -D__APPLE_OS__=true")
|
||||
elseif(WIN32)
|
||||
set(SD_X86_BUILD true)
|
||||
set(SD_X86_BUILD false)
|
||||
if (SD_CUDA)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-D_RELEASE=true")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG " /FS /EHsc")
|
||||
#set(CMAKE_CXX_FLAGS_DEBUG " /FS /EHsc")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fPIC -D_RELEASE=true")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG " -g -O2 -fPIC")
|
||||
|
@ -362,7 +368,7 @@ if(SD_BUILD_TESTS)
|
|||
# tests are always compiled with all ops included
|
||||
set(SD_ALL_OPS true)
|
||||
set(SD_BUILD_MINIFIER true)
|
||||
add_subdirectory(tests_cpu)
|
||||
add_subdirectory(src/test/cpp/tests_cpu)
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -370,7 +376,6 @@ if (MSVC_DEV)
|
|||
set(SD_BUILD_MINIFIER false)
|
||||
endif ()
|
||||
|
||||
set (CMAKE_INSTALL_PREFIX $ENV{ND4J_HOME}/bruai4j-native/bruai4j-native-common/src/main/resources)
|
||||
|
||||
# Set package information
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Native operations for nd4j.")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import org.gradle.api.internal.java.DefaultJavaPlatformExtension
|
||||
import org.gradle.api.plugins.internal.DefaultJavaPluginExtension
|
||||
import org.gradle.api.publish.maven.internal.publisher.MavenRemotePublisher
|
||||
import org.gradle.language.nativeplatform.internal.Dimensions
|
||||
|
||||
|
@ -44,8 +46,7 @@ buildscript {
|
|||
logger.info("Setting properties for task '{}' to '{}'", tsk.getName(), pf)
|
||||
return pf
|
||||
}
|
||||
|
||||
}
|
||||
} // End of ext block
|
||||
|
||||
|
||||
dependencies {
|
||||
|
@ -64,104 +65,106 @@ buildscript {
|
|||
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'org.bytedeco.gradle-javacpp-build' version "1.5.9"
|
||||
id 'org.bytedeco.gradle-javacpp-build' version "1.5.9" //version "1.5.10-SNAPSHOT"
|
||||
id 'maven-publish'
|
||||
id 'signing'
|
||||
}
|
||||
|
||||
chipList.each {thisChip ->
|
||||
sourceSets.register("${thisChip}Support") {
|
||||
chipList.each {String thisChip ->
|
||||
/*sourceSets.register(thisChip) {
|
||||
java {
|
||||
srcDirs = ['src/main/java', "${buildDir}/generated/sources/javacpp/${thisChip}//${javacppPlatform}${javacppPlatformExtension}/"]
|
||||
srcDirs = ["${projectDir}/src/main/java/"]
|
||||
include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Helper.java"
|
||||
include "org/nd4j/nativeblas/${thisChip}/Nd4j${thisChip.capitalize()}Presets.java"
|
||||
}
|
||||
}*/
|
||||
sourceSets.register("${thisChip}").configure {
|
||||
java {
|
||||
srcDirs = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"]
|
||||
include "org/nd4j/nativeblas/Nd4j${thisChip.capitalize()}.java"
|
||||
}
|
||||
it.compiledBy("javacpp${thisChip.capitalize()}SupportBuildCommand",
|
||||
"javacpp${thisChip.capitalize()}SupportBuildCompiler")
|
||||
compiledBy "javacpp${thisChip.capitalize()}SupportBuildCompiler"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if(osdetector.os.startsWith("windows")) {
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = ['src/main/java']
|
||||
include 'org/nd4j/nativeblas/Dummy.java'
|
||||
}
|
||||
/*
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = new HashSet<>();
|
||||
include 'org/nd4j/nativeblas/Dummy.java'
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// This block registers the cpu and cuda features and creates
|
||||
// i. e. the {chip}Implementation
|
||||
java {
|
||||
chipList.each {thisChip ->
|
||||
registerFeature("${thisChip}Support") {
|
||||
usingSourceSet(sourceSets.findByName("${thisChip}Support"))
|
||||
usingSourceSet(sourceSets.findByName("${thisChip}"))
|
||||
capability(project.group, "cavis-native-lib-${thisChip}-support", project.version)
|
||||
//withJavadocJar()
|
||||
//withSourcesJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}}}
|
||||
|
||||
dependencies {
|
||||
api platform(project(':cavis-common-platform'))
|
||||
implementation "org.bytedeco:javacpp"
|
||||
implementation group: "org.bytedeco", name: "javacpp", classifier: "${javacppPlatform}"
|
||||
|
||||
if(withCuda()) {
|
||||
cudaSupportImplementation platform(project(':cavis-common-platform'))
|
||||
cudaSupportImplementation project(":cavis-dnn:cavis-dnn-api")
|
||||
cudaSupportImplementation project(":cavis-dnn:cavis-dnn-common")
|
||||
cudaSupportImplementation project(":cavis-native:cavis-native-blas")
|
||||
cudaSupportImplementation project(":cavis-native:cavis-native-common")
|
||||
cudaSupportImplementation "commons-io:commons-io"
|
||||
cudaSupportImplementation group: "org.bytedeco", name: "openblas"
|
||||
cudaSupportImplementation group: "org.bytedeco", name: "openblas", classifier: "${javacppPlatform}"
|
||||
cudaSupportImplementation group: "org.bytedeco", name: "cuda"
|
||||
cudaSupportImplementation group: "org.bytedeco", name: "cuda", classifier: "${javacppPlatform}"
|
||||
cudaSupportImplementation "org.apache.logging.log4j:log4j-core:2.17.0"
|
||||
cudaSupportImplementation "com.google.guava:guava:14.0.1"
|
||||
cudaSupportImplementation "org.apache.commons:commons-lang3"
|
||||
cudaSupportImplementation "org.apache.commons:commons-math3"
|
||||
cudaSupportImplementation "com.google.flatbuffers:flatbuffers-java"
|
||||
cudaSupportImplementation 'javax.mail:javax.mail-api:1.6.2'
|
||||
cudaImplementation platform(project(':cavis-common-platform'))
|
||||
|
||||
//cudaImplementation project(":cavis-dnn:cavis-dnn-api")
|
||||
//cudaImplementation project(":cavis-dnn:cavis-dnn-common")
|
||||
cudaImplementation project(":cavis-native:cavis-native-blas")
|
||||
//cudaImplementation project(":cavis-native:cavis-native-common")
|
||||
//cudaImplementation "commons-io:commons-io"
|
||||
//cudaImplementation "org.bytedeco:openblas"
|
||||
//cudaImplementation "org.bytedeco:openblas::${javacppPlatform}"
|
||||
//cudaImplementation "org.bytedeco:cuda"
|
||||
//cudaImplementation "org.bytedeco:cuda::${javacppPlatform}"
|
||||
//cudaImplementation "org.apache.logging.log4j:log4j-core:2.17.0"
|
||||
//cudaImplementation "com.google.guava:guava:14.0.1"
|
||||
//cudaImplementation "org.apache.commons:commons-lang3"
|
||||
//cudaImplementation "org.apache.commons:commons-math3"
|
||||
//cudaImplementation "com.google.flatbuffers:flatbuffers-java"
|
||||
//cudaImplementation 'javax.mail:javax.mail-api:1.6.2'
|
||||
cudaImplementation "org.bytedeco:javacpp"
|
||||
cudaImplementation "org.bytedeco:javacpp::${javacppPlatform}"
|
||||
cudaImplementation project(":cavis-native:cavis-native-cuda-presets")
|
||||
|
||||
//cudaGeneratedImplementation platform(project(':cavis-common-platform'))
|
||||
//cudaGeneratedImplementation project(":cavis-native:cavis-native-blas")
|
||||
//cudaGeneratedImplementation "org.bytedeco:javacpp"
|
||||
//cudaGeneratedImplementation "org.bytedeco:javacpp::${javacppPlatform}"
|
||||
//cudaGeneratedImplementation project(":cavis-native:cavis-native-cuda-presets")
|
||||
}
|
||||
|
||||
if(withCpu()) {
|
||||
cpuSupportImplementation platform(project(':cavis-common-platform'))
|
||||
cpuSupportImplementation project(":cavis-dnn:cavis-dnn-api")
|
||||
cpuSupportImplementation project(":cavis-dnn:cavis-dnn-common")
|
||||
cpuSupportImplementation project(":cavis-native:cavis-native-blas")
|
||||
cpuSupportImplementation project(":cavis-native:cavis-native-common")
|
||||
cpuSupportImplementation "commons-io:commons-io"
|
||||
cpuSupportImplementation group: "org.bytedeco", name: "openblas"
|
||||
cpuSupportImplementation group: "org.bytedeco", name: "openblas", classifier: "${javacppPlatform}"
|
||||
cpuSupportImplementation group: "org.bytedeco", name: "opencv"
|
||||
cpuSupportImplementation group: "org.bytedeco", name: "opencv", classifier: "${javacppPlatform}"
|
||||
cpuSupportImplementation "org.apache.logging.log4j:log4j-core:2.17.0"
|
||||
cpuSupportImplementation "com.google.guava:guava:14.0.1"
|
||||
cpuSupportImplementation "org.apache.commons:commons-lang3"
|
||||
cpuSupportImplementation "org.apache.commons:commons-math3"
|
||||
cpuSupportImplementation "com.google.flatbuffers:flatbuffers-java"
|
||||
cpuSupportImplementation 'javax.mail:javax.mail-api:1.6.2'
|
||||
}
|
||||
cpuImplementation platform(project(':cavis-common-platform'))
|
||||
//cpuImplementation project(":cavis-dnn:cavis-dnn-api")
|
||||
//cpuImplementation project(":cavis-dnn:cavis-dnn-common")
|
||||
cpuImplementation project(":cavis-native:cavis-native-blas")
|
||||
//cpuImplementation project(":cavis-native:cavis-native-common")
|
||||
//cpuImplementation "commons-io:commons-io"
|
||||
//cpuImplementation "org.bytedeco:opencv"
|
||||
//cpuImplementation "org.bytedeco:opencv::${javacppPlatform}"
|
||||
//cpuImplementation "org.apache.logging.log4j:log4j-core:2.17.0"
|
||||
//cpuImplementation "com.google.guava:guava:14.0.1"
|
||||
//cpuImplementation "org.apache.commons:commons-lang3"
|
||||
//cpuImplementation "org.apache.commons:commons-math3"
|
||||
//cpuImplementation "com.google.flatbuffers:flatbuffers-java"
|
||||
//cpuImplementation 'javax.mail:javax.mail-api:1.6.2'
|
||||
cpuImplementation "org.bytedeco:javacpp"
|
||||
cpuImplementation "org.bytedeco:javacpp::${javacppPlatform}"
|
||||
// https://mvnrepository.com/artifact/org.bytedeco/openblas
|
||||
cpuImplementation 'org.bytedeco:openblas:0.3.23-1.5.9'
|
||||
|
||||
implementation projects.cavisDnn.cavisDnnApi
|
||||
implementation projects.cavisDnn.cavisDnnCommon
|
||||
implementation project(":cavis-native:cavis-native-blas")
|
||||
implementation project(":cavis-native:cavis-native-common")
|
||||
implementation "commons-io:commons-io"
|
||||
implementation "org.bytedeco:openblas"
|
||||
implementation group: "org.bytedeco", name: "openblas", classifier: "${javacppPlatform}"
|
||||
implementation "org.apache.logging.log4j:log4j-core"
|
||||
implementation "com.google.guava:guava:14.0.1"
|
||||
implementation "org.apache.commons:commons-lang3"
|
||||
implementation "org.apache.commons:commons-math3"
|
||||
implementation "com.google.flatbuffers:flatbuffers-java"
|
||||
|
||||
cpuImplementation project(":cavis-native:cavis-native-cpu-presets")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,40 +186,34 @@ task deepClean(type: Delete) {
|
|||
}
|
||||
|
||||
|
||||
tasks.withType(org.bytedeco.gradle.javacpp.BuildTask) {
|
||||
buildResource = [ "/org/bytedeco/openblas/${javacppPlatform}/",
|
||||
"/org/bytedeco/mkldnn/${javacppPlatform}/"]
|
||||
|
||||
includeResource = ["/org/bytedeco/openblas/${javacppPlatform}/include/"]
|
||||
|
||||
linkResource = ["/org/bytedeco/openblas/${javacppPlatform}/",
|
||||
"/org/bytedeco/openblas/${javacppPlatform}/lib/"]
|
||||
|
||||
//buildPath = [ org.bytedeco.javacpp.Loader.getCacheDir() ]
|
||||
tasks.withType(org.bytedeco.gradle.javacpp.BuildTask).configureEach { org.bytedeco.gradle.javacpp.BuildTask it ->
|
||||
/*
|
||||
it.buildResource = ["/org/bytedeco/openblas/${javacppPlatform}/",
|
||||
"/org/bytedeco/mkldnn/${javacppPlatform}/"]
|
||||
|
||||
it.includeResource = ["/org/bytedeco/openblas/${javacppPlatform}/include/"]
|
||||
|
||||
it.linkResource = ["/org/bytedeco/openblas/${javacppPlatform}/",
|
||||
"/org/bytedeco/openblas/${javacppPlatform}/lib/"]
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// Disable the standard javacpp generated tasks and use own
|
||||
// versions below. This allows to build for each variant
|
||||
|
||||
[javacppBuildParser, javacppBuildCommand, javacppCompileJava, javacppBuildCompiler].each {
|
||||
it.enabled false
|
||||
}
|
||||
|
||||
chipList.each { thisChip ->
|
||||
chipList.each { String thisChip ->
|
||||
|
||||
// 1)
|
||||
//Run the C++ compile first
|
||||
tasks.register("javacpp${thisChip.capitalize()}SupportBuildCommand", org.bytedeco.gradle.javacpp.BuildTask) {
|
||||
if (project.hasProperty("skip-native") && project.getProperty("skip-native").equals("true")) {
|
||||
enabled = false
|
||||
}
|
||||
dependsOn "processResources"
|
||||
tasks.register("javacpp${thisChip.capitalize()}SupportBuildCommand", org.bytedeco.gradle.javacpp.BuildTask) {org.bytedeco.gradle.javacpp.BuildTask it ->
|
||||
properties = getBuildPlatform( thisChip, it )
|
||||
|
||||
|
||||
includePath = ["${projectDir}/src/main/cpp/blas/",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/src/main/include/",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/flatbuffers-src/include",
|
||||
|
@ -226,19 +223,16 @@ chipList.each { thisChip ->
|
|||
//No idea why this is here, but it looks like even for the javacppBuildCommand task,
|
||||
//there is a javacpp Loader actively determining platform etc.
|
||||
classOrPackageNames = ["org.nd4j.nativeblas.${thisChip}.Nd4j${thisChip.capitalize()}Presets"]
|
||||
workingDirectory = projectDir
|
||||
//workingDirectory = projectDir
|
||||
//if the classpath is not set here, the javacpp classloader starts to look around
|
||||
//everywhere and causes java.io.IOExceptions: because files is being used by another process
|
||||
classPath = [:]
|
||||
classPath += ["${buildDir}/classes/java/${thisChip}Support/"]
|
||||
//classPath += ["${buildDir}/classes/java/main/"]
|
||||
//logger.quiet("Using compile classpath from configuration named '{}'", sourceSets.named(thisChip).get().getCompileClasspathConfigurationName())
|
||||
|
||||
classPath = sourceSets.named(thisChip).get().compileClasspath.collect()
|
||||
|
||||
/* Get VCVARS in case we want to build CUDA
|
||||
* MinGW64 g++ on MSYS is used otherwise */
|
||||
if (thisChip.equals('cuda') && osdetector.os.startsWith("win")
|
||||
&& project.hasProperty("skip-native")
|
||||
&& !project.getProperty("skip-native").equals("true")
|
||||
&& !VISUAL_STUDIO_INSTALL_DIR.isEmpty()) {
|
||||
if (thisChip.equals('cuda') && osdetector.os.startsWith("win") && !VISUAL_STUDIO_INSTALL_DIR.isEmpty()) {
|
||||
def proc = ["cmd.exe", "/c", "${VISUAL_STUDIO_VCVARS_CMD} > nul && set"].execute()
|
||||
it.environmentVariables = it.environmentVariables ?: [:]
|
||||
def lines = proc.text.split("\\r?\\n")
|
||||
|
@ -246,14 +240,15 @@ chipList.each { thisChip ->
|
|||
if (line.contains("=")) {
|
||||
def parts = line.split("=")
|
||||
it.environmentVariables.put(parts[0], parts[1])
|
||||
logger.debug("Added variable to environment: {} = {}", parts[0], parts[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
workingDirectory projectDir
|
||||
if (thisChip.equals('cuda') && osdetector.os.startsWith("windows")) { //cuDNN requires CUDA
|
||||
it.buildCommand = ['sh', 'buildnativeoperations.sh',
|
||||
'-V',
|
||||
'--build-type', 'release',
|
||||
'--build-type', 'debug',
|
||||
'--chip', thisChip,
|
||||
'--plattform', 'x86_64',
|
||||
'--chip-extension', avxExtension,
|
||||
|
@ -280,24 +275,13 @@ chipList.each { thisChip ->
|
|||
'-j', "${host_cores}",
|
||||
'--helper', 'mkldnn']
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Create a task to (pre)compile the java presets (required for javacppBuildParser)
|
||||
tasks.register("compile${thisChip.capitalize()}Support", JavaCompile) {
|
||||
def thisSS = sourceSets.findByName("${thisChip}Support")
|
||||
it.source = thisSS.allSource
|
||||
it.classpath = thisSS.compileClasspath
|
||||
it.destinationDirectory = file("${buildDir}/classes/java/${thisChip}Support/")
|
||||
if(project.hasProperty("nativeTests")) it.buildCommand += "--tests"
|
||||
}
|
||||
|
||||
//Run the parser on the InfoMap in Nd4j$ChipPresets and listed header files in @Platform
|
||||
//Generates Nd4jCpu.java and/ or Nd4jCuda.java Java JNI code
|
||||
tasks.register("javacpp${thisChip.capitalize()}SupportBuildParser", org.bytedeco.gradle.javacpp.BuildTask) {
|
||||
if (project.hasProperty("skip-native") && project.getProperty("skip-native").equals("true")) {
|
||||
enabled = false
|
||||
}
|
||||
dependsOn "compile${thisChip.capitalize()}Support"
|
||||
|
||||
|
||||
includePath = ["${projectDir}/src/main/cpp/blas/",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/src/main/include/",
|
||||
|
@ -305,43 +289,35 @@ chipList.each { thisChip ->
|
|||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/cpu_features-src/include",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/mkldnn-src/include"]
|
||||
|
||||
|
||||
|
||||
classOrPackageNames = ["org.nd4j.nativeblas.${thisChip}.Nd4j${thisChip.capitalize()}Presets"]
|
||||
outputDirectory = file("${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/")
|
||||
|
||||
classPath = sourceSets.getByName("${thisChip}Support").getRuntimeClasspath()
|
||||
classPath += ["${buildDir}/classes/java/${thisChip}Support/"]
|
||||
classPath = sourceSets.named(thisChip).get().compileClasspath.collect()
|
||||
outputDirectory file("${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/")
|
||||
}
|
||||
|
||||
|
||||
// Generates jnijavacpp.cpp and jniNativeLibrary.cpp, compiles and links it
|
||||
tasks.register("javacpp${thisChip.capitalize()}SupportBuildCompiler", org.bytedeco.gradle.javacpp.BuildTask) {
|
||||
if (project.hasProperty("skip-native") && project.getProperty("skip-native").equals("true")) {
|
||||
enabled = false
|
||||
}
|
||||
def thisTask = (org.bytedeco.gradle.javacpp.BuildTask) it
|
||||
thisTask.dependsOn = ["javacpp${thisChip.capitalize()}SupportBuildParser"]
|
||||
tasks.register("javacpp${thisChip.capitalize()}SupportBuildCompiler", org.bytedeco.gradle.javacpp.BuildTask) {org.bytedeco.gradle.javacpp.BuildTask it ->
|
||||
|
||||
thisTask.linkPath = ["${projectDir}/blasbuild/${thisChip}/${avxExtension}/output"]
|
||||
thisTask.includePath = ["${projectDir}/src/main/cpp/blas/",
|
||||
linkPath = ["${projectDir}/blasbuild/${thisChip}/${avxExtension}/output"]
|
||||
includePath = ["${projectDir}/src/main/cpp/blas/",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/src/main/include/",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/flatbuffers-src/include",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/cpu_features-src/include",
|
||||
"${projectDir}/blasbuild/${thisChip}/${avxExtension}/mkldnn-src/include"]
|
||||
|
||||
thisTask.properties = getBuildPlatform( thisChip, thisTask )
|
||||
properties = getBuildPlatform( thisChip, it )
|
||||
|
||||
if(thisChip.equals('cuda') && osdetector.os.startsWith("win") && project.hasProperty("skip-native")
|
||||
&& !project.getProperty("skip-native").equals("true") && !VISUAL_STUDIO_INSTALL_DIR.isEmpty()) {
|
||||
if(thisChip.equals('cuda') && osdetector.os.startsWith("win") && !VISUAL_STUDIO_INSTALL_DIR.isEmpty()) {
|
||||
def proc = ["cmd.exe", "/c", "${VISUAL_STUDIO_VCVARS_CMD} > nul && where.exe cl.exe"].execute()
|
||||
def outp = proc.text
|
||||
def cl = outp.replace("\\", "\\\\").trim()
|
||||
def cl = "\"" + outp.replace("\\", "\\\\").trim() + "\""
|
||||
def currentCompiler = ""
|
||||
doFirst{
|
||||
currentCompiler = System.getProperty("org.bytedeco.javacpp.platform.compiler")
|
||||
System.setProperty("org.bytedeco.javacpp.platform.compiler", cl)
|
||||
logger.quiet("Task ${thisTask.name} overrides compiler '${currentCompiler}' with '${cl}'.")
|
||||
System.setProperty("platform.compiler.cpp11", cl)
|
||||
logger.quiet("Task ${name} overrides compiler '${currentCompiler}' with '${cl}'.")
|
||||
|
||||
}
|
||||
doLast {
|
||||
//restore compiler
|
||||
|
@ -350,12 +326,12 @@ chipList.each { thisChip ->
|
|||
//System.setProperty("org.bytedeco.javacpp.platform.compiler.cpp11", cl)
|
||||
|
||||
proc = ["cmd.exe", "/c", "${VISUAL_STUDIO_VCVARS_CMD} > nul && set"].execute()
|
||||
thisTask.environmentVariables = thisTask.environmentVariables ?: [:]
|
||||
environmentVariables = environmentVariables ?: [:]
|
||||
def lines = proc.text.split("\\r?\\n")
|
||||
for (def line in lines) {
|
||||
if (line.contains("=")) {
|
||||
def parts = line.split("=")
|
||||
thisTask.environmentVariables.put(parts[0], parts[1])
|
||||
environmentVariables.put(parts[0], parts[1])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,32 +340,27 @@ chipList.each { thisChip ->
|
|||
}
|
||||
|
||||
|
||||
thisTask.buildPath = ["$buildDir/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"]
|
||||
thisTask.copyLibs = true
|
||||
thisTask.deleteJniFiles(false)
|
||||
outputName = "jnind4j${thisChip}"
|
||||
thisTask.outputDirectory = file("$buildDir/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/")
|
||||
thisTask.classOrPackageNames= ["org.nd4j.nativeblas.Nd4j${thisChip.capitalize()}"]
|
||||
buildPath = ["${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/"]
|
||||
copyLibs = true
|
||||
deleteJniFiles(false)
|
||||
//outputName = "jnind4j${thisChip}"
|
||||
outputDirectory = file("${buildDir}/generated/sources/javacpp/${thisChip}/${javacppPlatform}${javacppPlatformExtension}/")
|
||||
classOrPackageNames= ["org.nd4j.nativeblas.Nd4j${thisChip.capitalize()}"]
|
||||
|
||||
thisTask.configDirectory = file("${buildDir}/classes/java/${thisChip}Support/META-INF/native-image/${javacppPlatform}")
|
||||
|
||||
//Need to set the classpath, so that external jars from the dependency list are resolved by the ClassLoader as well
|
||||
thisTask.classPath = [:]
|
||||
thisTask.classPath = ["${buildDir}/classes/java/${thisChip}Support"]
|
||||
thisTask.classPath += sourceSets.findByName("${thisChip}Support").runtimeClasspath
|
||||
//sourceSets.findByName("${thisChip}Support").runtimeClasspath.each{ s ->
|
||||
// thisTask.classPath += s
|
||||
//}
|
||||
configDirectory = file("${buildDir}/classes/java/${thisChip}Support/META-INF/native-image/${javacppPlatform}")
|
||||
classPath = sourceSets.named("${thisChip}").get().compileClasspath.collect()
|
||||
classPath += "${buildDir}/classes/java/${thisChip}/"
|
||||
}
|
||||
|
||||
// Create Jar with classifier
|
||||
tasks.getByName("${thisChip}SupportJar") { Jar thisTask ->
|
||||
tasks.named("${thisChip}Jar").configure { Jar thisTask ->
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler"
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCommand"
|
||||
|
||||
//it.from sourceSets.getByName("${thisChip}Support").getOutput()
|
||||
|
||||
def spec = copySpec {
|
||||
from(tasks.getByName("javacpp${thisChip.capitalize()}SupportBuildCompiler")) {
|
||||
|
||||
from(tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").get()) {
|
||||
exclude { f ->
|
||||
def exclude = f.file.isDirectory()
|
||||
if(exclude) {
|
||||
|
@ -401,8 +372,8 @@ chipList.each { thisChip ->
|
|||
}
|
||||
into "${javacppPlatform}/" //path within jar, we need it in a platform, that javacpp Loader understands
|
||||
}
|
||||
from(sourceSets.getByName("${thisChip}Support").getOutput()) {
|
||||
|
||||
from(sourceSets.named(thisChip).get().getOutput()) {
|
||||
into "${javacppPlatform}/" //path within jar, we need it in a platform, that javacpp Loader understands
|
||||
}
|
||||
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
@ -414,34 +385,43 @@ chipList.each { thisChip ->
|
|||
|
||||
//Before we can compile the whole java part, we
|
||||
//need to generate the Nd4jXXX.java files first
|
||||
chipList.each { thisChip ->
|
||||
tasks.findByName("compile${thisChip.capitalize()}SupportJava").each { t ->
|
||||
t.dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser"
|
||||
tasks.named("compileJava").configure {enabled false}
|
||||
|
||||
chipList.each { String thisChip ->
|
||||
//ensure full build process is running on "build"
|
||||
tasks.named("build").configure {
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler"
|
||||
}
|
||||
//Compiles and links the generated jni code with the underlying native library
|
||||
tasks.named("javacpp${thisChip.capitalize()}SupportBuildCompiler").configure {
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser"
|
||||
}
|
||||
//Generates the jni interface sources
|
||||
tasks.named("javacpp${thisChip.capitalize()}SupportBuildParser").configure {
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCommand"
|
||||
}
|
||||
//Compiles the c++ and cuda sources
|
||||
tasks.named("javacpp${thisChip.capitalize()}SupportBuildCommand").configure {
|
||||
|
||||
}
|
||||
//Compile the generates jni interface (java portion)
|
||||
tasks.named("compile${thisChip.capitalize()}Java").configure {
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildParser"
|
||||
}
|
||||
|
||||
tasks.named("${thisChip}Jar").configure {
|
||||
dependsOn "javacpp${thisChip.capitalize()}SupportBuildCompiler"
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
// options.setCompilerArgs(Arrays.asList("-Xlint:unchecked"))
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
// options.setCompilerArgs(Arrays.asList("-Xlint:unchecked"))
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc) {
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
|
||||
/*
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Class-Path': configurations.runtimeClasspath.collect { it.getName() }.join(' '),
|
||||
'Implementation-Title': 'Brutex AI - Native Components',
|
||||
'Implementation-Vendor': 'Brutex Network',
|
||||
'Implementation-Version': archiveVersion,
|
||||
'Specification-Title': 'Brutex AI - Native Components',
|
||||
'Specification-Vendor': 'Brutex Network',
|
||||
'Specification-Version': archiveVersion
|
||||
}
|
||||
//archiveClassifier = "${javacppPlatform}${javacppPlatformExtension}-${chip}"
|
||||
}
|
||||
*/
|
||||
javadoc {
|
||||
dependsOn "javacppPomProperties"
|
||||
failOnError = false
|
||||
|
@ -451,10 +431,6 @@ javadoc {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
tasks.getByName("generatePomFileForMavenJavaPublication") {
|
||||
enabled = true
|
||||
}
|
||||
|
@ -464,32 +440,14 @@ javadoc {
|
|||
|
||||
artifacts {
|
||||
//implementation(jar)
|
||||
chipList.each { thisChip ->
|
||||
implementation(tasks.getByName("${thisChip}SupportJar"))
|
||||
|
||||
chipList.each { String thisChip ->
|
||||
implementation tasks.getByName("${thisChip}Jar")
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
artifacts {
|
||||
archives jar
|
||||
chipList.each { thisChip ->
|
||||
archives tasks.getByName("${thisChip}SupportJar")
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact jar
|
||||
chipList.each { thisChip ->
|
||||
artifact tasks.getByName("${thisChip}SupportJar")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
|
||||
if( osdetector.os.startsWith("windows")) {
|
||||
|
@ -515,48 +473,6 @@ if( osdetector.os.startsWith("windows")) {
|
|||
}
|
||||
*/
|
||||
|
||||
task printDeps {
|
||||
doLast {
|
||||
configurations.apiElements.dependencies.each { dep ->
|
||||
println "${dep.group} - ${dep.name} - ${dep.version}"
|
||||
dep.artifacts.each { art ->
|
||||
println " ${art.extension} - ${art.classifier}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
def pomClosure = {
|
||||
name = 'Brutex AI - Native Components'
|
||||
delegate.description = 'Underlying native components for the Brutex AI deeplearning framework for Java'
|
||||
url = 'https://ai.brutex.net'
|
||||
licenses {
|
||||
license {
|
||||
name = 'Apache License, Version 2.0'
|
||||
url = 'http://www.apache.org/licenses/LICENSE-2.0'
|
||||
distribution = 'repo'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = 'irnbrux'
|
||||
name = 'Brian Rosenberger'
|
||||
email = 'bru@brutex.de'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = 'https://brutex.net/svn/'
|
||||
connection = 'scm:svn:https://brutex.net/svn/bruai4j/'
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//tasks.getByName("publishMavenJavaPublicationToOSSRHRepository") { MavenRemotePublisher pub ->
|
||||
// logger.quiet(pub.dump());
|
||||
//}
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
if (!version.endsWith('SNAPSHOT')) {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
# ******************************************************************************/
|
||||
#
|
||||
|
||||
|
||||
#env
|
||||
|
||||
set -eu
|
||||
|
|
|
@ -102,16 +102,18 @@ ENDIF()
|
|||
|
||||
IF(${SD_EXTENSION} MATCHES "avx2")
|
||||
message("Extension AVX2 enabled.")
|
||||
set(ARCH_TUNE "${ARCH_TUNE} -mmmx -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -mf16c -mprefetchwt1 -DSD_F16C=true -DF_AVX2=true")
|
||||
#-mmmx -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -mf16c -mprefetchwt1
|
||||
set(ARCH_TUNE "${ARCH_TUNE} -DSD_F16C=true -DF_AVX2=true")
|
||||
ELSEIF(${SD_EXTENSION} MATCHES "avx512")
|
||||
message("Extension AVX512 enabled.")
|
||||
# we need to set flag here, that we can use hardware f16 conversion + tell that cpu features should be tracked
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmmx -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -mf16c -mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd -mbmi -mbmi2 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves -DSD_F16C=true -DF_AVX512=true")
|
||||
#-mmmx -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx -mavx2 -mfma -mf16c -mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd -mbmi -mbmi2 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves
|
||||
set(ARCH_TUNE "${ARCH_TUNE} -DSD_F16C=true -DF_AVX512=true")
|
||||
ENDIF()
|
||||
|
||||
if (NOT WIN32)
|
||||
# we don't want this definition for msvc
|
||||
set(ARCH_TUNE "-march=${SD_ARCH} -mtune=${ARCH_TYPE}")
|
||||
set(ARCH_TUNE "${ARCH_TUNE} -march=${SD_ARCH} -mtune=${ARCH_TYPE}")
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" AND SD_X86_BUILD)
|
||||
|
@ -125,7 +127,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
|
|||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_TUNE} -O3 -fp-model fast")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
# using Visual Studio C++
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_TUNE}")
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_TUNE} /Ox")
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
# using GCC
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_TUNE} -fmax-errors=2 -fdiagnostics-show-caret ")
|
||||
|
@ -159,15 +161,10 @@ if(HAVE_ARMCOMPUTE)
|
|||
file(GLOB_RECURSE CUSTOMOPS_ARMCOMPUTE_SOURCES false ops/declarable/platform/armcompute/*.cpp ops/declarable/platform/armcompute/*.h)
|
||||
endif()
|
||||
|
||||
if(SD_CUDA)
|
||||
message("Build cublas")
|
||||
if(NOT DEFINED ${CMAKE_CUDA_ARCHITECTURES})
|
||||
set(CMAKE_CUDA_ARCHITECTURES 75)
|
||||
endif()
|
||||
message(STATUS "CUDA architectures set to ${CMAKE_CUDA_ARCHITECTURES}")
|
||||
|
||||
find_package(CUDAToolkit)
|
||||
enable_language(CUDA)
|
||||
if(SD_CUDA)
|
||||
#find_package(CUDAToolkit)
|
||||
#enable_language(CUDA)
|
||||
|
||||
set(CMAKE_CUDA_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
@ -176,6 +173,9 @@ if(SD_CUDA)
|
|||
#Enable features prio C++17
|
||||
add_definitions(-D_HAS_AUTO_PTR_ETC=1)
|
||||
|
||||
set(CMAKE_CUDA_RUNTIME_LIBRARY "shared")
|
||||
set(CMAKE_CUDA_ARCHITECTURES "61") #set(CMAKE_CUDA_ARCHITECTURES "62;75")
|
||||
|
||||
#This basically kills instrinsic activated through SD_F16C=true
|
||||
#if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
# set (CMAKE_CXX_FLAGS "")
|
||||
|
@ -203,47 +203,29 @@ if(SD_CUDA)
|
|||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=-fPIC")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
message("In windows, setting cublas library and cusolver library")
|
||||
if(NOT DEFINED CUDA_cublas_LIBRARY)
|
||||
set(CUDA_cublas_LIBRARY ${CUDA_HOME}/lib/x64/cublas.lib)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED CUDA_cusolver_LIBRARY)
|
||||
set(CUDA_cusolver_LIBRARY ${CUDA_HOME}/lib/x64/cusolver.lib)
|
||||
endif()
|
||||
endif()
|
||||
# if(WIN32)
|
||||
# message("In windows, setting cublas library and cusolver library")
|
||||
# if(NOT DEFINED CUDA_cublas_LIBRARY)
|
||||
# set(CUDA_cublas_LIBRARY ${CUDA_HOME}/lib/x64/cublas.lib)
|
||||
# endif()
|
||||
|
||||
#
|
||||
#string( TOLOWER "${COMPUTE}" COMPUTE_CMP )
|
||||
# if ("${COMPUTE_CMP}" STREQUAL "all")
|
||||
# CUDA_SELECT_NVCC_ARCH_FLAGS(CUDA_ARCH_FLAGS "Common")
|
||||
# elseif("${COMPUTE_CMP}" STREQUAL "auto")
|
||||
# CUDA_SELECT_NVCC_ARCH_FLAGS(CUDA_ARCH_FLAGS "Auto")
|
||||
# elseif(COMPUTE_CMP MATCHES "^[0-9]+$")
|
||||
# #matches USER COMPUTE old way
|
||||
#set(CUDA_ARCH_FLAGS "-gencode arch=compute_${COMPUTE},code=sm_${COMPUTE} ")
|
||||
# else()
|
||||
# #matches numbers NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX
|
||||
# #NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal
|
||||
# #NUM: 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 et cetera
|
||||
# CUDA_SELECT_NVCC_ARCH_FLAGS(CUDA_ARCH_FLAGS "${COMPUTE}")
|
||||
# if(NOT DEFINED CUDA_cusolver_LIBRARY)
|
||||
# set(CUDA_cusolver_LIBRARY ${CUDA_HOME}/lib/x64/cusolver.lib)
|
||||
# endif()
|
||||
# endif()
|
||||
# list to spaces
|
||||
#string (REPLACE ";" " " CUDA_ARCH_FLAGS "${CUDA_ARCH_FLAGS}")
|
||||
|
||||
#set(CMAKE_CUDA_FLAGS " ${CMAKE_CUDA_FLAGS} -DCUDA_VERSION_MAJOR=${CUDA_VERSION_MAJOR} ${EXPM} -w --cudart=static --expt-extended-lambda -Xfatbin -compress-all ")
|
||||
set(CMAKE_CUDA_ARCHITECTURES OFF)
|
||||
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code \"arch=compute_53,code=[compute_53,sm_53]\" " )
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code \"arch=compute_61,code=[compute_61,sm_61]\" " )
|
||||
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code \"arch=compute_61,code=[compute_61,sm_61]\" " )
|
||||
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --generate-code \"arch=compute_75,code=[compute_75,sm_75]\" " )
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda ")
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr ")
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -DCUDA_VERSION_MAJOR=11 -w --cudart=static -Xfatbin -compress-all")
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -DCUDA_VERSION_MAJOR=12 -w -Xfatbin -compress-all")
|
||||
set(CUDAHOSTCXX "${CMAKE_CXX_COMPILER}")
|
||||
if(WIN32)
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=/EHsc")
|
||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler=/EHsc -Xcompiler=/bigobj")
|
||||
endif()
|
||||
#set(GPU_ARCH)
|
||||
|
||||
message("CMAKE_CUDA_FLAGS = ${CMAKE_CUDA_FLAGS}")
|
||||
message("CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
|
||||
|
@ -253,6 +235,9 @@ if(SD_CUDA)
|
|||
message("CUDA_NVCC_FLAGS = ${CUDA_NVCC_FLAGS}")
|
||||
message("CUDA_PROPAGATE_HOST_FLAGS = ${CUDA_PROPAGATE_HOST_FLAGS}")
|
||||
message("CUDA_ARCH_FLAGS = ${CUDA_ARCH_FLAGS}")
|
||||
message("CUDAHOSTCXX = ${CUDAHOSTCXX}")
|
||||
message("CMAKE_CUDA_ARCHITECTURES = ${CMAKE_CUDA_ARCHITECTURES}")
|
||||
message("CMAKE_CUDA_RUNTIME_LIBRARY = ${CMAKE_CUDA_RUNTIME_LIBRARY}")
|
||||
|
||||
file(GLOB_RECURSE PERF_SOURCES false performance/*.cpp performance/*.h)
|
||||
file(GLOB_RECURSE EXCEPTIONS_SOURCES false exceptions/*.cpp exceptions/*.h)
|
||||
|
@ -299,33 +284,36 @@ if(SD_CUDA)
|
|||
|
||||
# build shared library by default or when it's explicitly requested
|
||||
if(NOT SD_STATIC_LIB OR SD_SHARED_LIB)
|
||||
message("Will build a shared library '${SD_LIBRARY_NAME}'.")
|
||||
add_library(${SD_LIBRARY_NAME} SHARED $<TARGET_OBJECTS:samediff_obj>)
|
||||
endif()
|
||||
|
||||
if (SD_STATIC_LIB AND SD_SHARED_LIB)
|
||||
# if both static and shared library are going to be built - static library will have special suffix
|
||||
message("Will build a static library '${SD_LIBRARY_NAME}static'.")
|
||||
add_library(${SD_LIBRARY_NAME}static STATIC $<TARGET_OBJECTS:samediff_obj>)
|
||||
set_property(TARGET ${SD_LIBRARY_NAME}static PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME}static PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_LIBRARY}$<$<CONFIG:Debug>:Debug>")
|
||||
install(TARGETS ${SD_LIBRARY_NAME}static DESTINATION .)
|
||||
elseif(SD_STATIC_LIB)
|
||||
# if we only build static library - use this name
|
||||
add_library(${SD_LIBRARY_NAME} STATIC $<TARGET_OBJECTS:samediff_obj>)
|
||||
set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_LIBRARY}$<$<CONFIG:Debug>:Debug>")
|
||||
install(TARGETS ${SD_LIBRARY_NAME} DESTINATION .)
|
||||
endif()
|
||||
|
||||
# on windows we want to make sure we use MT or MD, but since we use it in one lib, we must use it everywhere to avoid conflicts
|
||||
set_property(TARGET samediff_obj PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET samediff_obj PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_LIBRARY}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RUNTIME_LIBRARY}$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
# Done by nvcc as default on windows
|
||||
if(WIN32)
|
||||
message("CUDA on Windows: enabling /EHsc")
|
||||
message("CUDA on Windows: enabling /EHsc and /bigobj")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /bigobj")
|
||||
endif()
|
||||
|
||||
#target_link_libraries(${SD_LIBRARY_NAME} ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_cusolver_LIBRARY} ${CUDNN} ${MKLDNN})
|
||||
target_link_libraries(${SD_LIBRARY_NAME} CUDA::cudart CUDA::cublas CUDA::cusolver ${CUDNN} ${MKLDNN})
|
||||
target_link_libraries(${SD_LIBRARY_NAME} CUDA::cudart CUDA::cublas CUDA::cusolver CUDA::cublasLt Threads::Threads ${CUDNN} ${MKLDNN})
|
||||
#target_link_libraries(${SD_LIBRARY_NAME} ${CUDNN} ${MKLDNN})
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/cuda/${SD_EXTENSION})
|
||||
install(TARGETS ${SD_LIBRARY_NAME} DESTINATION .)
|
||||
|
@ -437,13 +425,13 @@ elseif(SD_CPU)
|
|||
# if both static and shared library are going to be built - static library will have special suffix
|
||||
message("Adding a static library for ${SD_LIBRARY_NAME} as ${SD_LIBRARY_NAME}static")
|
||||
add_library(${SD_LIBRARY_NAME}static STATIC $<TARGET_OBJECTS:samediff_obj>)
|
||||
set_property(TARGET ${SD_LIBRARY_NAME}static PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME}static PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
install(TARGETS ${SD_LIBRARY_NAME}static DESTINATION .)
|
||||
elseif(SD_STATIC_LIB)
|
||||
# if we only build static library - use this name
|
||||
message(Only building a static library for ${SD_LIBRARY_NAME})
|
||||
add_library(${SD_LIBRARY_NAME} STATIC $<TARGET_OBJECTS:samediff_obj>)
|
||||
set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
#set_property(TARGET ${SD_LIBRARY_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "${MSVC_RT_LIB}$<$<CONFIG:Debug>:Debug>")
|
||||
install(TARGETS ${SD_LIBRARY_NAME} DESTINATION .)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -460,13 +448,13 @@ elseif(SD_CPU)
|
|||
|
||||
#This breaks the build. Normally you want to run tests anyways.
|
||||
if(NOT "$ENV{CLION_IDE}")
|
||||
target_link_libraries(${SD_LIBRARY_NAME} ${MKLDNN} ${MKLDNN_LIBRARIES} ${ARMCOMPUTE_LIBRARIES} ${OPENBLAS_LIBRARIES} ${BLAS_LIBRARIES} ${CPU_FEATURES})
|
||||
target_link_libraries(${SD_LIBRARY_NAME} Threads::Threads ${MKLDNN} ${MKLDNN_LIBRARIES} ${ARMCOMPUTE_LIBRARIES} ${OPENBLAS_LIBRARIES} ${BLAS_LIBRARIES} ${CPU_FEATURES})
|
||||
endif()
|
||||
|
||||
if ("${SD_ALL_OPS}" AND "${SD_BUILD_MINIFIER}")
|
||||
message(STATUS "Building minifier...")
|
||||
add_executable(minifier ../minifier/minifier.cpp ../minifier/graphopt.cpp)
|
||||
target_link_libraries(minifier samediff_obj ${MKLDNN_LIBRARIES} ${ARMCOMPUTE_LIBRARIES} ${OPENBLAS_LIBRARIES} ${MKLDNN} ${BLAS_LIBRARIES} ${CPU_FEATURES})
|
||||
target_link_libraries(minifier samediff_obj Threads::Threads ${MKLDNN_LIBRARIES} ${ARMCOMPUTE_LIBRARIES} ${OPENBLAS_LIBRARIES} ${MKLDNN} ${BLAS_LIBRARIES} ${CPU_FEATURES})
|
||||
endif()
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS 4.9)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
include_directories(../../../../../src/main/cpp/blas)
|
||||
if(LINUX)
|
||||
link_directories(/usr/local/lib)
|
||||
link_directories(/usr/lib)
|
||||
|
@ -21,10 +21,18 @@ if(WIN32)
|
|||
endforeach()
|
||||
endif()
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if (SD_CUDA)
|
||||
find_package(CUDA)
|
||||
message("Tests CUDA include directory: ${CUDA_INCLUDE_DIRS}")
|
||||
include_directories(${CUDA_INCLUDE_DIRS})
|
||||
find_package(CUDAToolkit 12.2 REQUIRED)
|
||||
enable_language(CUDA)
|
||||
|
||||
set(CMAKE_CUDA_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
message("Tests CUDA include directory: ${CUDAToolkit_INCLUDE_DIRS}")
|
||||
include_directories(${CUDAToolkit_INCLUDE_DIRS})
|
||||
add_definitions(-D__CUDABLAS__=true)
|
||||
|
||||
if(WIN32)
|
||||
|
@ -34,17 +42,14 @@ if (SD_CUDA)
|
|||
|
||||
string( TOLOWER "${COMPUTE}" COMPUTE_CMP )
|
||||
if ("${COMPUTE_CMP}" STREQUAL "all")
|
||||
CUDA_SELECT_NVCC_ARCH_FLAGS(CUDA_ARCH_FLAGS "Common")
|
||||
set(CMAKE_CUDA_ARCHITECTURES "all")
|
||||
elseif("${COMPUTE_CMP}" STREQUAL "auto")
|
||||
CUDA_SELECT_NVCC_ARCH_FLAGS(CUDA_ARCH_FLAGS "Auto")
|
||||
elseif(COMPUTE_CMP MATCHES "^[0-9]+$")
|
||||
#matches USER COMPUTE old way
|
||||
set(CUDA_ARCH_FLAGS "-gencode arch=compute_${COMPUTE},code=sm_${COMPUTE} ")
|
||||
set(CMAKE_CUDA_ARCHITECTURES "all-major")
|
||||
else()
|
||||
#matches numbers NAME | NUM.NUM | NUM.NUM(NUM.NUM) | NUM.NUM+PTX
|
||||
#NAME: Fermi Kepler Maxwell Kepler+Tegra Kepler+Tesla Maxwell+Tegra Pascal
|
||||
#NUM: 2.0 2.1 3.0 3.2 3.5 3.7 5.0 5.2 5.3 6.0 6.2 et cetera
|
||||
CUDA_SELECT_NVCC_ARCH_FLAGS(CUDA_ARCH_FLAGS "${COMPUTE}")
|
||||
set(CMAKE_CUDA_ARCHITECTURES "all")
|
||||
endif()
|
||||
# list to spaces
|
||||
string (REPLACE ";" " " CUDA_ARCH_FLAGS "${CUDA_ARCH_FLAGS}")
|
||||
|
@ -149,7 +154,7 @@ if (SD_CPU)
|
|||
endif()
|
||||
|
||||
add_executable(runtests ${TEST_SOURCES})
|
||||
target_link_libraries(runtests samediff_obj ${MKLDNN_LIBRARIES} ${OPENBLAS_LIBRARIES} ${MKLDNN} ${BLAS_LIBRARIES} ${CPU_FEATURES} ${ARMCOMPUTE_LIBRARIES} gtest gtest_main)
|
||||
target_link_libraries(runtests samediff_obj Threads::Threads ${MKLDNN_LIBRARIES} ${OPENBLAS_LIBRARIES} ${MKLDNN} ${BLAS_LIBRARIES} ${CPU_FEATURES} ${ARMCOMPUTE_LIBRARIES} gtest gtest_main)
|
||||
elseif(SD_CUDA)
|
||||
|
||||
add_executable(runtests ${TEST_SOURCES})
|
||||
|
@ -167,5 +172,5 @@ elseif(SD_CUDA)
|
|||
message("CUDNN library: ${CUDNN}")
|
||||
endif()
|
||||
|
||||
target_link_libraries(runtests samediff_obj ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_cusolver_LIBRARY} ${CUDNN} ${MKLDNN} gtest gtest_main)
|
||||
target_link_libraries(runtests samediff_obj Threads::Threads ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_cusolver_LIBRARY} ${CUDNN} ${MKLDNN} gtest gtest_main)
|
||||
endif()
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue