diff --git a/README.md b/README.md index f3f3142..c16894b 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,17 @@ and remains in a not-quite-complete state. Its previous main use was to run [StarDist](https://qupath.readthedocs.io/en/0.2/docs/advanced/stardist.html) nucleus identification, although the new [QuPath StarDist extension](https://github.com/qupath/qupath-extension-stardist) does not require that TensorFlow is available. +> **Important!** TensorFlow Java does not currently support Mac computers with Apple silicon. + ## Building +There is no pre-built version of the TensorFlow extension at this time, because most people shouldn't need it and there are lots of different permutations of dependencies that might be required for different platforms. + +For that reason, it needs to be built from source. +If you want to match to a specific version, you can download the source from the [releases](https://github.com/qupath/qupath-extension-tensorflow/releases) page. + + ### Extension + dependencies separately You can build the extension with @@ -37,7 +45,7 @@ extension and all its dependencies with gradlew clean shadowjar ``` -### GPU support +### Alternative platforms The default build process will use TensorFlow for the CPU. @@ -48,11 +56,35 @@ To use any of these, add the platform to any of the building tasks above. For example, to create a single GPU-friendly jar, use ```bash -gradlew clean shadowjar -P platform=gpu +gradlew clean build copyDependencies -P platform=gpu ``` The platforms available at the time of writing are `mkl`, `gpu`, `mkl-gpu`. +> Not all options are available for all operating systems. +> For example, GPU support is not available with macOS. + + +### GPU support + +When using `platform=gpu`, you will need +* an NVIDIA GPU +* CUDA and cuDNN + +Installation may be simplified if you include + +```bash +gradlew clean build copyDependencies -P platform=gpu -Pcuda-redist +``` + +to download the required CUDA files via JavaCPP. + +Before using this option, please check https://github.com/bytedeco/javacpp-presets/tree/master/cuda for +the terms of license agreements for NVIDIA software included in the archives. + +> **Warning!** At the time of writing, the CUDA version used with TensorFlow Java differs from that +> used with OpenCV via JavaCPP. This is likely to cause problems if trying to use both. + ## Installing diff --git a/build.gradle b/build.gradle index c7de1a0..e332001 100644 --- a/build.gradle +++ b/build.gradle @@ -34,12 +34,12 @@ ext.moduleName = 'qupath.extension.tensorflow' description = 'QuPath extension to use TensorFlow' -version = "0.3.0-SNAPSHOT" +version = "0.3.0-rc2" dependencies { def tensorflowVersion = "0.3.2" def cudaVersion = "11.0-8.0-1.5.4" // Warning! This doesn't match version with QuPath v0.3.0 + opencv-platform-gpu - def qupathVersion = "0.3.0-SNAPSHOT" // For now + def qupathVersion = "0.3.0-rc2" // For now def platform = project.findProperty("platform") @@ -62,13 +62,21 @@ dependencies { testImplementation "io.github.qupath:qupath-gui-fx:${qupathVersion}" testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.2" testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' - + } processResources { from ("${projectDir}/LICENSE.txt") { into 'licenses/' } + + doLast { + if (useCuda) { + logger.quiet("Requesting CUDA support - by downloading these archives you agree to the terms of the license " + + " agreements for NVIDIA software included in the archives.") + logger.quiet("See https://github.com/bytedeco/javacpp-presets/tree/master/cuda for more information.") + } + } } tasks.register("copyDependencies", Copy) { @@ -90,6 +98,7 @@ java { withSourcesJar() if (project.properties['javadocs']) withJavadocJar() + } /* @@ -113,4 +122,4 @@ tasks.withType(org.gradle.jvm.tasks.Jar) { tasks.named('test') { useJUnitPlatform() -} \ No newline at end of file +} diff --git a/src/main/java/qupath/ext/tensorflow/TensorFlowExtension.java b/src/main/java/qupath/ext/tensorflow/TensorFlowExtension.java index aae900e..14abd10 100644 --- a/src/main/java/qupath/ext/tensorflow/TensorFlowExtension.java +++ b/src/main/java/qupath/ext/tensorflow/TensorFlowExtension.java @@ -24,6 +24,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import qupath.lib.common.Version; import qupath.lib.gui.QuPathGUI; import qupath.lib.gui.extensions.GitHubProject; import qupath.lib.gui.extensions.QuPathExtension; @@ -61,6 +62,10 @@ public GitHubRepo getRepository() { return GitHubRepo.create(getName(), "qupath", "qupath-extension-tensorflow"); } + @Override + public Version getQuPathVersion() { + return Version.parse("0.3.0-rc2"); + } }