nanoporetech / dorado

Oxford Nanopore's Basecaller
https://nanoporetech.com/
Other
441 stars 54 forks source link

[error] Unsupported device: metal | Attempting to use M3 Pro GPU for Dorado Basecalling #837

Closed akhilp24 closed 1 month ago

akhilp24 commented 1 month ago

Issue Report

Please describe the issue:

I am attempting to run Dorado on an M3 Pro MacBook Pro using the GPU accessed through the Metal API. The instructions after running -h to do this tells me I should specify metal after the --device tag. However, after I do this, I receive the error:

[error] Unsupported device: metal

In Mike Vella's presentation regarding Dorado as well as the documentation, it states that Dorado works with Apple's Metal API; however, for Dorado (and Remora) I have been unable to utilize the GPU on my machine for any of the processes. This command works by using the CPU to complete this process.

Please provide a clear and concise description of the issue you are seeing and the result you expect.

Steps to reproduce the issue:

This is the command I have inputted:

dorado basecaller --device metal --emit-moves dna_r10.4.1_e8.2_400bps_hac@v4.3.0 /Users/akhilpeddikuppa/Downloads/FAX31810another.pod5 --reference /Users/akhilpeddikuppa/Downloads/referenceshort.fasta --kit-name SQK-RPB004 > secondrun.bam

Please list any steps to reproduce the issue.

Run environment:

Logs

vellamike commented 1 month ago

Hi, can you leave the device argument out? run the command as follows:

dorado basecaller --emit-moves dna_r10.4.1_e8.2_400bps_hac@v4.3.0 /Users/akhilpeddikuppa/Downloads/FAX31810another.pod5 --reference /Users/akhilpeddikuppa/Downloads/referenceshort.fasta --kit-name SQK-RPB004 > secondrun.bam
blawrence-ont commented 1 month ago

Dorado version: 0.6.2+14a7067a

Please note that the latest version is 0.7.0 and can be downloaded from this link https://github.com/nanoporetech/dorado?tab=readme-ov-file#installation.

The error message [error] Unsupported device: metal suggests that you're running a CPU-only build. Did you download the executable from an older readme or build it yourself?

akhilp24 commented 1 month ago

Hi, can you leave the device argument out? run the command as follows:

dorado basecaller --emit-moves dna_r10.4.1_e8.2_400bps_hac@v4.3.0 /Users/akhilpeddikuppa/Downloads/FAX31810another.pod5 --reference /Users/akhilpeddikuppa/Downloads/referenceshort.fasta --kit-name SQK-RPB004 > secondrun.bam

Dorado version: 0.6.2+14a7067a

Please note that the latest version is 0.7.0 and can be downloaded from this link https://github.com/nanoporetech/dorado?tab=readme-ov-file#installation.

The error message [error] Unsupported device: metal suggests that you're running a CPU-only build. Did you download the executable from an older readme or build it yourself?

After installing the latest Dorado version and running the above command, basecalling is running; however, it is only using the CPU. I also updated MacOS to Sonoma 14.5.

Here is a screenshot of my Activity Monitor:

image image

This file size is 368.5 MB. Thank you!

blawrence-ont commented 1 month ago

Just to confirm, you are launching the newly installed dorado and not accidentally using an older version? ie running dorado --version should report 0.7.0+71cc7442

akhilp24 commented 1 month ago

Just to confirm, you are launching the newly installed dorado and not accidentally using an older version? ie running dorado --version should report 0.7.0+71cc7442

Yes

image
blawrence-ont commented 1 month ago

Hmm, I'm not sure why the executable doesn't default to, or accept, metal as a device. Can you confirm that file reports the executable as arm64 and not x86_64, and that the checksum matches the following:

% file dorado
dorado: Mach-O 64-bit executable arm64
% shasum dorado 
2ecdf402e41baea45668deadf08eca6877c918dc  dorado

Also can you try running the following locally and seeing if that works:

wget https://cdn.oxfordnanoportal.com/software/analysis/dorado-0.7.0-osx-arm64.zip
unzip dorado-0.7.0-osx-arm64.zip
cd dorado-0.7.0-osx-arm64
./bin/dorado download --model dna_r10.4.1_e8.2_400bps_hac@v4.3.0
./bin/dorado basecaller --device metal --emit-moves dna_r10.4.1_e8.2_400bps_hac@v4.3.0 /Users/akhilpeddikuppa/Downloads/FAX31810another.pod5 --reference /Users/akhilpeddikuppa/Downloads/referenceshort.fasta --kit-name SQK-RPB004 > secondrun.bam
akhilp24 commented 1 month ago

Hmm, I'm not sure why the executable doesn't default to, or accept, metal as a device. Can you confirm that file reports the executable as arm64 and not x86_64, and that the checksum matches the following:

% file dorado
dorado: Mach-O 64-bit executable arm64
% shasum dorado 
2ecdf402e41baea45668deadf08eca6877c918dc  dorado

Also can you try running the following locally and seeing if that works:

wget https://cdn.oxfordnanoportal.com/software/analysis/dorado-0.7.0-osx-arm64.zip
unzip dorado-0.7.0-osx-arm64.zip
cd dorado-0.7.0-osx-arm64
./bin/dorado download --model dna_r10.4.1_e8.2_400bps_hac@v4.3.0
./bin/dorado basecaller --device metal --emit-moves dna_r10.4.1_e8.2_400bps_hac@v4.3.0 /Users/akhilpeddikuppa/Downloads/FAX31810another.pod5 --reference /Users/akhilpeddikuppa/Downloads/referenceshort.fasta --kit-name SQK-RPB004 > secondrun.bam

Hmm, after running file dorado, it says Mach-O 64-bit executable x86_64. How should I go about fixing this?

blawrence-ont commented 1 month ago

That means that you have an Intel macOS build rather than an Apple Silicon build, only the latter of which has metal support. There should only be an Apple Silicon build available from https://github.com/nanoporetech/dorado?tab=readme-ov-file#installation, so where are you installing the Intel build from?

akhilp24 commented 1 month ago

That means that you have an Intel macOS build rather than an Apple Silicon build, only the latter of which has metal support. There should only be an Apple Silicon build available from https://github.com/nanoporetech/dorado?tab=readme-ov-file#installation, so where are you installing the Intel build from?

I used the git clone command noted in the documentation:

$ git clone https://github.com/nanoporetech/dorado.git dorado $ cd dorado $ cmake -S . -B cmake-build $ cmake --build cmake-build --config Release -j $ ctest --test-dir cmake-build

blawrence-ont commented 1 month ago

You shouldn't need to build it yourself unless you plan to modify/extend dorado, and should use the pre-built versions instead.

FWIW I get an arm64 executable when following those instructions. Are you running any of those commands through something that's running under Rosetta? That will tell the build system that it's an Intel machine and will avoid building the metal backend.

akhilp24 commented 1 month ago

You shouldn't need to build it yourself unless you plan to modify/extend dorado, and should use the pre-built versions instead.

FWIW I get an arm64 executable when following those instructions. Are you running any of those commands through something that's running under Rosetta? That will tell the build system that it's an Intel machine and will avoid building the metal backend.

Oh hmm, I was using iTerm as a CLI which was loaded after I transferred the files from my Intel MacBook to my new Macbook. That may be the issue. Thank you!