Running DEM-Engine from Jupyter notebook

62 views
Skip to first unread message

Yves ROBERT

unread,
Mar 19, 2024, 5:04:16 PM3/19/24
to ProjectChrono
Hello,

I would like to know how to run DEM-Engine within a Jupyter notebook.
Indeed, I obtain the following error:

Compiler options: -diag-suppress=550 -diag-suppress=177 -arch=compute_ -std=c++11
Traceback (most recent call last):
  File "/home/cloud/PBR_DEME/test.py", line 46, in <module>
    S.Instance.Initialize()
RuntimeError: NVRTC error: NVRTC_ERROR_INVALID_OPTION

I also face this- same issue when using the trimesh python module outside of Jupyter. However, I would like to know what triggers that error so that I will hopefully solve both issues.

Thanks!

Ruochun Zhang

unread,
Mar 22, 2024, 4:42:02 AM3/22/24
to ProjectChrono
Hi Yves,

If you say this also happens to other packages like trimesh which is fully CPU-based, then I suspect it's the C++ compiler version. C++11 is way too old for anything. You should try updating the compiler that you are using for the installation of all the packages so it supports newer standards, at least C++17. That is my best guess at this moment.

Thank you,
Ruochun

Yves ROBERT

unread,
Mar 22, 2024, 10:04:22 AM3/22/24
to ProjectChrono
Hi Ruochun,

It is quite difficult to install the tool given the cuda version to use. I made it after trying several combinations for a long time.
The following is a script I made to install on Ubuntu 22.04 and my type of graphic cards (on a fresh instance):

#!/bin/bash

# Remove old versions of CUDA and NVIDIA tools
sudo apt-get --purge remove -y "cublas*" "cuda*" "nvidia*"
sudo rm -rf /usr/local/cuda*
sudo apt-get autoremove -y && sudo apt-get autoclean -y

# Install necessary utilities and libraries
sudo apt-get update
sudo apt-get install -y g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev

# Install new CUDA, version 12.0 (amd, Ubuntu 22.04)
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo dpkg -i cuda-repo-ubuntu2204-12-0-local_12.0.0-525.60.13-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-12-0-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get install -y cuda-12.0

# Update environment variables
echo 'export PATH=/usr/local/cuda-12.0/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.0/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc

# Install Miniconda
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda

# Initialize Conda for the shell
$HOME/miniconda/bin/conda init
echo 'export PATH="$HOME/miniconda/bin:$PATH"' >> ~/.bashrc

# Activate conda environment
source $HOME/.bashrc
source $HOME/miniconda/bin/activate

# Install conda environment and tools
conda create -y -n pyDEME python=3.11
conda activate pyDEME
conda install -y cmake
pip3 install DEME

# OPTIONAL: few tools I use
conda config --add channels conda-forge
conda install -y seaborn matplotlib numpy scipy trimesh paraview shapely gmsh PyArrow
pip install gmsh

echo "Installation completed. Please reboot your system to apply all changes and for the CUDA installation to be fully operational."

I am not sure what exactly I am missing, to be honest.

Best regards,
Yves

Ruochun Zhang

unread,
Mar 22, 2024, 4:29:09 PM3/22/24
to ProjectChrono
Hi Yves,, 

I don't see a big problem here. The -arch option is suspicious, since it should be compute_XX, like compute_80, to specify a compute capability. But why it appears not detected or how it interacts with using Jupyter, I do not know, since I don't use it. 

If it's about that your device is not detected while using Jupyter, then I don't know if I can reproduce that. I can have a try, but unable to guarantee. I would suggest that you try if you can run any other CUDA-based packages using Jupyter. BTW I don't know why trimesh could have this problem and it's weird.

Ruochun
Reply all
Reply to author
Forward
0 new messages