Skip to content

Commit

Permalink
Merge pull request #42 from qupath/ensure-cpu-listed
Browse files Browse the repository at this point in the history
ensure cpu is always an available device
  • Loading branch information
kaczmarj authored Nov 4, 2023
2 parents 693a576 + dccf38e commit 281c08b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.2.1

* Fix CPU/GPU support (https://github.com/qupath/qupath-extension-wsinfer/issues/41)

## v0.2.0

* [Preprint on arXiv](https://arxiv.org/abs/2309.04631)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {

ext.moduleName = 'io.github.qupath.extension.wsinfer'

version = "0.2.0"
version = "0.2.1"
description = 'An extension to run WSInfer in QuPath'

// The default 'gradle.ext.qupathVersion' reads this from settings.gradle.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/qupath/ext/wsinfer/ui/PytorchManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ static Collection<String> getAvailableDevices() {
boolean includesMPS = false; // Don't add MPS twice
var engine = getEngineOffline();
if (engine != null) {
// This is expected to return GPUs if available, or CPU otherwise
for (var device : engine.getDevices()) {
String name = device.getDeviceType();
availableDevices.add(name);
Expand All @@ -50,7 +51,7 @@ static Collection<String> getAvailableDevices() {
}
}
// CPU should always be available
if (availableDevices.isEmpty())
if (!availableDevices.contains("cpu"))
availableDevices.add("cpu");

// If we could use MPS, but don't have it already, add it
Expand Down

0 comments on commit 281c08b

Please sign in to comment.