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

RbowtieCuda #3672

Open
10 tasks done
FranckRICHARD01 opened this issue Dec 1, 2024 · 11 comments
Open
10 tasks done

RbowtieCuda #3672

FranckRICHARD01 opened this issue Dec 1, 2024 · 11 comments
Labels
1. awaiting moderation submitted and waiting clearance to access resources

Comments

@FranckRICHARD01
Copy link

Update the following URL to point to the GitHub repository of
the package you wish to submit to Bioconductor

Confirm the following by editing each check box to '[x]'

  • I understand that by submitting my package to Bioconductor,
    the package source and all review commentary are visible to the
    general public.

  • I have read the Bioconductor Package Submission
    instructions. My package is consistent with the Bioconductor
    Package Guidelines.

  • I understand Bioconductor Package Naming Policy and acknowledge
    Bioconductor may retain use of package name.

  • I understand that a minimum requirement for package acceptance
    is to pass R CMD check and R CMD BiocCheck with no ERROR or WARNINGS.
    Passing these checks does not result in automatic acceptance. The
    package will then undergo a formal review and recommendations for
    acceptance regarding other Bioconductor standards will be addressed.

  • My package addresses statistical or bioinformatic issues related
    to the analysis and comprehension of high throughput genomic data.

  • I am committed to the long-term maintenance of my package. This
    includes monitoring the support site for issues that users may
    have, subscribing to the bioc-devel mailing list to stay aware
    of developments in the Bioconductor community, responding promptly
    to requests for updates from the Core team in response to changes in
    R or underlying software.

  • I am familiar with the Bioconductor code of conduct and
    agree to abide by it.

I am familiar with the essential aspects of Bioconductor software
management, including:

  • The 'devel' branch for new packages and features.
  • The stable 'release' branch, made available every six
    months, for bug fixes.
  • Bioconductor version control using Git
    (optionally via GitHub).

For questions/help about the submission process, including questions about
the output of the automatic reports generated by the SPB (Single Package
Builder), please use the #package-submission channel of our Community Slack.
Follow the link on the home page of the Bioconductor website to sign up.

@bioc-issue-bot
Copy link
Collaborator

Hi @FranckRICHARD01

Thanks for submitting your package. We are taking a quick
look at it and you will hear back from us soon.

The DESCRIPTION file for this package is:

Package: RbowtieCuda
Type: Package
Title: An R Wrapper for nvBowtie and nvBWT, a rewritten version of Bowtie2 for cuda
Version: 0.99.0
Date: 2024-12-01
Authors@R: 
        c(person(given = "Jacopo", family = "Pantaleoni", role = c("aut"), 
  email = "[email protected]"),
        person(given = "Nuno", family = "Subtil", role = c("aut"), 
  email = "[email protected]"),
        person(given = "Samuel", family = "Simon-Sanchez", role = c("aut"), 
  email = "[email protected]"),
        person(given = "Franck", family = "RICHARD", role = c("aut","cre"), 
  email = "[email protected]"))
Description: This package provides an R wrapper for the popular Bowtie2 sequencing read aligner,
 optimized to run on NVIDIA graphics cards. It includes wrapper functions that enable both genome 
 indexing and alignment to the generated indexes, ensuring high performance and ease of use within the R environment.
License: BSD_3_clause + file LICENSE
Depends: R (>= 4.4.0), SummarizedExperiment
Encoding: UTF-8
Suggests: 
    knitr,
    testthat (>= 3.0.0),
    rmarkdown,
    RUnit,
    BiocGenerics
SystemRequirements: C++17, GNU make, CUDA Toolkit (<= 12.4), MSVC, libthrust-dev, libcub-dev, gcc (< 14.0)
Archs: x64
RoxygenNote: 7.3.2
biocViews: Sequencing, Alignment, Preprocessing, Coverage
VignetteBuilder: knitr
Config/testthat/edition: 3
NeedsCompilation: yes
Author: c(Jacopo Pantaleoni [aut],
  Nuno Subtil  [aut],
  Samuel Simon Sanchez [aut],
  Franck RICHARD [aut, cre])
BugReports: https://github.com/FranckRICHARD01/RbowtieCuda/issues 
URL: https://github.com/FranckRICHARD01/RbowtieCuda, https://belacqua-labo.ovh/bioinformatic/RbowtieCuda

@bioc-issue-bot bioc-issue-bot added the 1. awaiting moderation submitted and waiting clearance to access resources label Dec 1, 2024
@hpages
Copy link
Contributor

hpages commented Dec 10, 2024

Hi @FranckRICHARD01,

Thanks for this submission.

Please move the installation_cuda*.sh scripts to inst/scripts/. Unfortunately our Linux and Windows builders (nebbiolo1 and palomino7) don't have NVIDIA GPUs. How can we handle this? Can CUDA be used on non NVIDIA GPUs? Do we need to install some kind of generic CUDA-compatible drivers for that? Of course, this kind of workaround will have poor performance but at least it would allow RbowtieCuda to "work" on our builders.

Also I suppose that the package is not supported on macOS right?

Thanks,
H.

@FranckRICHARD01
Copy link
Author

FranckRICHARD01 commented Dec 10, 2024

Hi hpages!

Okay for the scripts. I'll move them.
No, unfortunately, you need a Nvidia graphics card to run a program made with Cuda.
There is still no universal driver to simulate Cuda.
I could compile executables for Linux and Windows, but I have no idea how to run the program on your builders.
Am I the first to propose a Cuda-compatible program under bioconductor?
I don't have a Mac myself and Apple refuses to accept Nvidia cards in its desktops...

Franck

@lshep
Copy link
Contributor

lshep commented Dec 17, 2024

This is the first submission with a request for Cuda; our current builders don't have Nvidia GPU's. We are exploring solutions and will respond soon

@FranckRICHARD01
Copy link
Author

Thanks Ishep!

@hpages
Copy link
Contributor

hpages commented Dec 21, 2024

Hi @FranckRICHARD01,

In the INSTALL file:

  • should be "in the 'inst/scripts' directory" instead of "in the 'inst' directory";
  • should be src/nvbio/CMakefile.txt instead of src/nvbio-1.1.00/CMakefile.txt

Call me a chicken but I'm not going to run a shell script that makes a bunch of changes on my system via sudo access. Way too scary! 😉 Even if I could somehow mitigate the fear factor by copying and executing the commands in the script one at a time.

Also this approach doesn't play well with the situation where I'm already on an Ubuntu system with an NVIDIA GPU that has already been used for other things so we know that some drivers are already installed (maybe not ones that are compatible with RbowtieCuda though), and also maybe some components of the CUDA development suite are already there (but I don't know which, if any). Maybe I'm lucky and all the things that are needed by RbowtieCuda are already there after all, in which case I shouldn't need to touch anything on the system.

Long story short: I'd like to know where my system stands w.r.t. to RbowtieCuda's needs. Right now I'm a little bit in the dark.

So I was wondering if you could provide a small set of instructions that allow me to assess the situation before making changes on my system. For example, the very last steps of the installation_cuda*.sh script are:

# Finally, to verify the installation, check
nvidia-smi
nvcc -V

But instead of putting this at the very end, I'd rather be told to try these commands before touching anything on the machine. Then depending on what output I get (you should explain what output we're expected to see there), explain what actions should be taken in order to correct the situation.

This approach could be implemented via 2 scripts: a diagnostic script that does not require sudo access, and a "setup cuda" script that requires sudo access. More precisely:

  • The diagnostic script would tell me whether I need to make any change on the system or if the system is ready to go. Note that a traditional configure script is the standard way that most R packages perform the "diagnostic" step.
  • Then I would use the "setup cuda" script to correct the problems reported by the diagnostic script, but only if needed (i.e. if the diagnostic script tells me to do so). This script would be similar to your installation_cuda11.8.sh script but I think it would be less scary to run if it was more transparent about what it's actually doing (or about to do). For example, it would be less intimidating if it was more interactive e.g. by asking for my approval before each step, and after telling me exactly what command it's about to run.

As Lori (@lshep) said earlier we're a little bit in exploratory mode at the moment with this, until we figure out the best way to handle submissions that require an NVIDIA GPU. So sorry in advance if the process is not as smooth as with regular submissions. The goal is not only to be able to run our daily build/checks on packages like RbowtieCuda but also to make sure that Bioconductor users will be able to easily install and run them on their (expensive) hardware.

BTW do you know how they handle packages like yours on CRAN? Do they have builders with NVIDIA GPUs? We might be able to learn from them.

Thanks,
H.

@hpages
Copy link
Contributor

hpages commented Dec 21, 2024

FWIW here is a concrete example of how easily one can break things on an Ubuntu system when trying to install some of the nvidia/cuda stuff.

I ceated an Ubuntu 24.04 instance on Jetstream2. Jetstream2 is an academic cloud environment where one can create and run virtual machines. They offer Ubuntu 24.04 instances that have an NVIDIA A100 GPU. These instances come with some carefully selected nvidia/cuda packages (Ubuntu/Debian and maybe some 3rd party) pre-installed on the system.

So on a fresh instance, nvidia-smi works out of the box and reports:

NVIDIA-SMI 535.216.01     Driver Version: 535.216.01    CUDA Version: 12.2

This is all good.

However, the nvcc command (which seems to be required by RbowtieCuda) is not pre-installed. So I decided to install it with sudo apt install nvidia-cuda-toolkit. (By the way, you list the "CUDA Toolkit" in your SystemRequirements field but the nvidia-cuda-toolkit package is mentioned nowhere in your installation instructions or in your installation_cuda*.sh scripts.)

To my surprise sudo apt install nvidia-cuda-toolkit triggered the installation of 100+ packages! That means a lot of potential for things to go wrong.

A few minutes later, even though the installation of the 100+ packages seemed to have completed successfully, I noticed that the long output of apt install displayed the following error message towards the end (not a fatal error though, apt install kept doing a few more things after that):

Restarting services...
 systemctl restart nvidia-persistenced.service
Job for nvidia-persistenced.service failed because the control process exited with error code.
See "systemctl status nvidia-persistenced.service" and "journalctl -xeu nvidia-persistenced.service" for details.

I tried rebooting but that did not help: systemctl status nvidia-persistenced.service still reported a failure after reboot.

Anyways, at least now I had the Nvidia CUDA Compiler:

$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Fri_Jan__6_16:45:21_PST_2023
Cuda compilation tools, release 12.0, V12.0.140
Build cuda_12.0.r12.0/compiler.32267302_0

However, now nvidia-smi was gone:

$ nvidia-smi
-bash: /usr/bin/nvidia-smi: No such file or directory

And after I managed to get it back with sudo apt-get install nvidia-utils-535, I got:

exouser@gpubuilder2:~$ nvidia-smi
Failed to initialize NVML: Driver/library version mismatch
NVML library version: 535.183

So the only thing I did was to try to install the Nvidia CUDA Compiler (which seems to be required by RbowtieCuda), but I ended up with a broken system. Any idea what I did wrong?

Thanks,
H.

@FranckRICHARD01
Copy link
Author

FranckRICHARD01 commented Dec 21, 2024

Hello Hervé and thank you for your comments!

(Based on your configuration, I'm talking about the installation of cuda-12-2)

Yes, you're absolutely right. You should have two different scripts created to take fewer risks during installation! No need to risk breaking anything, especially if cuda is already preinstalled. I'll modify this quickly.

The nvcc command is essential if you want to compile the program, as it is the cuda compiler.
The error message indicates an incompatibility between the version of Cuda and the version of the graphics card's nvidia driver. As a result, the system cannot run.
You also need to pay attention to the gcc installed. For example, Cuda 12.2 can only work with a gcc version < 13. This can be managed quite easily with symbolic links.

In fact, the most important script commands are these (and shouldn't cause any problems) :

*add a general graphics driver repository to handle compatibility issues (but it's probably not essential, I'll check).
sudo add-apt-repository ppa:graphics-drivers/ppa

*add the official nvidia repository, this is essential because in the preinstalled distribution you're talking about, cuda drivers may be perimated and pose dependency problems :

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub

*Update the list of packages :
sudo apt update

Until that time, these manipulations cannot have any particular consequences on the system.

*The rest can be considerably simplified. Installing the cuda-12-2 package is sufficient to install the compatible nvidia driver too:
sudo apt install cuda-12-2

echo 'export PATH=/usr/local/cuda-12.2/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.2/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
sudo ldconfig

I don't think there will be any problems with nvidia-smi and nvcc commands...

I've probably neglected the installation of pre-requisites and the stress this can cause. This needs to be reviewed.

Could you please try again ?

My apologies,

Franck

@FranckRICHARD01
Copy link
Author

FranckRICHARD01 commented Dec 21, 2024

Hello again hpages!

(Based on your configuration, I'm talking about the installation of cuda-12-2)

Coming back to your description of the problems with your installation, here are a few remarks:

  • It's quite normal for the installation of the nvidia-cuda-toolkit package to result in a large number of secondary packages being installed. You can expect to install almost 1GB of additional data. This is due to nvidia's heavy development tools, which contain a large number of libraries.

Some packages, such as Sight Compute and Sight Systems, which are used for debugging, are particularly heavy (250MB each, I believe). Of course, it would be simpler if it were possible to offer a pre-compiled tool that would save you installing all the libraries and debugging/compiling tools.

-Your system isn't broken at all. It's just that nvidia are quite picky about getting the right version of cuda and the right version of gcc on the system, otherwise this kind of problem could arise.

First of all (and this is important), install the kernel headers. As the driver will be compiled, the core headers are absolutely essential :

sudo apt install linux-headers-$(uname -r)

then type :

sudo modprobe nvidia

To solve the problem of nvidia-smi that no longer exists, you can do:

sudo ubuntu-drivers autoinstall

don't forget to do this at the end so that a terminal can find nvcc :

echo 'export PATH=/usr/local/cuda-12.2/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.2/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
sudo ldconfig

reboot...

nvidia-smi and nvcc commands must work

The new inst/verif.sh script should confirm that the installation is ok.

PS: When compiling RbowtieCuda, you may receive messages from the nvidia compiler telling you that the gcc version is incompatible... In this case, you'll need to install gcc-12 and g++-12 and make symbolic links in this way:

sudo apt install gcc-12 g++-12

and create symmetrical links to activate gcc-12 and g++-12 :

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 10

sudo update-alternatives --config gcc

(choose gcc-12)

sudo update-alternatives --config g++

(select g++-12)

@hpages
Copy link
Contributor

hpages commented Dec 21, 2024

Thanks for all the info. I'll try again asap. (I'll be travelling for the next few days so expect some delays.)

@FranckRICHARD01
Copy link
Author

Many thanks to you hpages. I'm going to propose two new scripts to try and make the installation easier and more flexible. Happy holidays!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. awaiting moderation submitted and waiting clearance to access resources
Projects
None yet
Development

No branches or pull requests

4 participants