From b5b5e6cd39a37b09ae4aedb95ede78b4586acb39 Mon Sep 17 00:00:00 2001 From: Jonas Osmann Date: Wed, 18 Dec 2024 15:18:55 -0500 Subject: [PATCH 1/3] [fix] fix incorrect boolean check for GPU forwarding GPU would be forwarded regardless of what the user selected because of incorrect check. --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 73b6beb7..62736979 100755 --- a/install.sh +++ b/install.sh @@ -364,7 +364,7 @@ services: shm_size: ${shm_mem} EOF - if [[ $gpu ]]; then + if [[ "${gpu}" == true ]]; then cat >>docker-compose.yml < Date: Wed, 18 Dec 2024 15:40:34 -0500 Subject: [PATCH 2/3] [feat] add additional fn to check for Nvidia GPU with CUDA Added a fn that checks whether an Nvidia GPU is installed that supports CUDA. This fn will run if GPU forwarding is selected by the user and exit with error code 1 if no compatible GPU is detected. --- install.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/install.sh b/install.sh index 62736979..2d51646c 100755 --- a/install.sh +++ b/install.sh @@ -348,6 +348,30 @@ function parse_args() { # DOCKER COMPOSE # ################## +#!/bin/bash + +function check_gpu() { + # Check if nvidia-smi is available (NVIDIA driver installed) + if ! command -v nvidia-smi &> /dev/null; then + echo "ERROR: nvidia-smi command not found. Make sure the NVIDIA driver and CUDA are installed." + exit 1 + fi + + # Check if any GPUs are detected by nvidia-smi + gpu_count=$(nvidia-smi --query-gpu=count --format=csv,noheader,nounits) + + if [[ "$gpu_count" -gt 0 ]]; then + echo "Found $gpu_count Nvidia GPU(s) on your system." + + # Optionally: Check if CUDA is supported + cuda_version=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader,nounits) + echo "CUDA supported with driver version $cuda_version." + else + echo "No Nvidia GPUs found or GPUs are not accessible." + exit 1 + fi +} + function populate_docker_compose() { # Generate docker-compose.yml file cat >docker-compose.yml <>docker-compose.yml < Date: Mon, 23 Dec 2024 11:49:56 -0500 Subject: [PATCH 3/3] [feat] improve ACE documentation --- .../tutorials/workflows/ace_flow/ace_flow.rst | 81 ++++++++++--------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/docs/tutorials/workflows/ace_flow/ace_flow.rst b/docs/tutorials/workflows/ace_flow/ace_flow.rst index 99ffd230..6dcabb3e 100644 --- a/docs/tutorials/workflows/ace_flow/ace_flow.rst +++ b/docs/tutorials/workflows/ace_flow/ace_flow.rst @@ -4,14 +4,13 @@ ACE Workflow **A**\ I-based **C**\ artography of **E**\ nsembles (**ACE**) pipeline highlights: 1. Cutting-edge vision transformer and CNN-based DL architectures trained on - very large LSFM datasets (`link to sample data `__ - and :ref:`refer to example section`) to map brain-wide local/laminar neuronal activity. + very large LSFM datasets (:ref:`refer to example section`) + to map brain-wide local/laminar neuronal activity. 2. Optimized cluster-wise statistical analysis with a threshold-free enhancement approach to chart subpopulation-specific effects at the laminar and local level, without restricting the analysis to atlas-defined regions - (`link to sample data `__ - and :ref:`refer to example section`). -3. Modules for providing DL model uncertainty estimates and fine-tuning (in a future release). + (:ref:`refer to example section`). +3. Modules for providing DL model uncertainty estimates and fine-tuning. 4. Interface with MIRACL registration. 5. Ability to map the connectivity between clusters of activations. @@ -22,26 +21,9 @@ To install the ACE workflow, refer to the MIRACL installation guide: - :doc:`Installation guide <../../../installation/installation>` -Video Tutorial -============== - -`Video tutorial `_ - -- This video tutorial covers the following topics: - - MIRACL installation validation - - Download sample data - - Run ACE on a single subject (Mode 2) including deep learning - segmentation of cFos+ cells, registration, voxelization, and warping - - Analyze the results of the above step - - Run ACE cluster-wise statistical algorithm between two groups to map - local cell activation - - Analyze the results of the above step - -.. TODO: update the tutorial link - .. note:: - Make sure that you set the GPU option during installation using the ``-g`` flag. + Make sure that you set the GPU option during installation. Once the installation is complete, enter the ``docker`` container using ``docker exec -it bash`` and run the ``nvidia-smi`` command to ensure your GPU is detected. @@ -86,6 +68,23 @@ These models will be included by default in a future release once ACE is publish files to the right location **outside** the docker container will make them available inside the container. +Video Tutorial +============== + +`Video tutorial `_ + +- This video tutorial covers the following topics: + - MIRACL installation validation + - Download sample data + - Run ACE on a single subject (Mode 2) including deep learning + segmentation of cFos+ cells, registration, voxelization, and warping + - Analyze the results of the above step + - Run ACE cluster-wise statistical algorithm between two groups to map + local cell activation + - Analyze the results of the above step + +.. TODO: update the tutorial link + Main Inputs ============ @@ -347,8 +346,11 @@ Main outputs .. _example_anchor: +Examples +======== + Example of running ACE flow on multiple subjects (Mode 1): -========================================================== +---------------------------------------------------------- .. code-block:: @@ -360,8 +362,8 @@ Example of running ACE flow on multiple subjects (Mode 1): --sa_resolution 1.4 1.4 5.0 -Example of running ACE on single subject (Mode 2) (`link to sample data `__): -====================================================================================================================================================================================== +Example of running ACE on single subject (Mode 2: Segmentation & Registration): +------------------------------------------------------------------------------- .. note:: @@ -378,6 +380,8 @@ Example of running ACE on single subject (Mode 2) (`link to sample data `_. + .. code-block:: $ miracl flow ace \ @@ -402,8 +406,8 @@ Example of running ACE on single subject (Mode 2) (`link to sample data `__): -========================================================================================================================================================================================================== +Example of running ACE on one single subject (Mode 2: Segmentation Only): +------------------------------------------------------------------------- .. note:: @@ -420,6 +424,8 @@ Example of running only ACE segmentation module on one single subject (`link to you want to download. For this tutorial, you will need to download option ``1``. + Alternatively, download mode 2 sample data `here `_. + .. code-block:: $ miracl seg ace \ @@ -429,8 +435,8 @@ Example of running only ACE segmentation module on one single subject (`link to --sa_batch_size 2 -Example of running only ACE cluster wise analysis on voxelized and warped segmentation maps (`link to sample data `__): -=============================================================================================================================================================================================================================== +Example of running only ACE cluster wise analysis on voxelized and warped segmentation maps: +-------------------------------------------------------------------------------------------- .. note:: @@ -447,13 +453,15 @@ Example of running only ACE cluster wise analysis on voxelized and warped segmen you want to download. For this tutorial, you will need to download option ``2``. - .. code-block:: + Alternatively, download stats sample data `here `_. - $ miracl stats ace \ - --control ./ctrl/ \ - --treated ./treated/ \ - --sa_output_folder ./output_dir \ - --rwc_voxel_size 25 +.. code-block:: + + $ miracl stats ace \ + --control ./ctrl/ \ + --treated ./treated/ \ + --sa_output_folder ./output_dir \ + --rwc_voxel_size 25 More information on the ``miracl stats ace`` function can be found :doc:`here <../../stats/ace_cluster/ace_cluster>`. @@ -509,3 +517,4 @@ and hyperparameters for the fine-tuning process. The script will output the fine-tuned model weights in the output directory. The user can then :ref:`use this model to run the ACE workflow above`. +