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

Can we run this library in google colab #1

Open
sohailiqbal opened this issue Dec 8, 2020 · 4 comments
Open

Can we run this library in google colab #1

sohailiqbal opened this issue Dec 8, 2020 · 4 comments

Comments

@sohailiqbal
Copy link

Is it possible to run this library in google colab.

@simonzhang00
Copy link
Owner

simonzhang00 commented Dec 8, 2020

Yes, as long as Google colab will allow you to run the commands git, cmake, apt, make, nvcc, python3, pip3 etc you can build as you would on a local machine.

Building from source is very consistent. This is how you would install the python bindings of ripser++ in Google colab:

  1. To use GPU on Google Colab, create a new notebook. Then runtime-> change runtime type-> GPU

  2. In this fresh notebook, run the command !pwd. It should say /content. If not, then run:

import os
os.chdir('/content')
  1. clone the repository:
!git clone https://github.com/simonzhang00/ripser-plusplus.git'
  1. install cmake:
!apt update
!apt install -y cmake
  1. build the .so file (this is what gets executed when you run python code on top of ripser++)
import os
os.chdir('/content/ripser-plusplus/python/bin')
!pwd
!cmake /content/ripser-plusplus/python && make
  1. install ripser++ for python
!pip3 install /content/ripser-plusplus/python/
  1. To run the examples.py file run:
import os
os.chdir('/content/ripser-plusplus/python/working_directory')
!pwd`
!python3 "examples.py"

Don't forget, if you want to remove verbosity, uncomment the two lines:

#define PROFILING
#define COUNTING

from ripser++.cu and don't forget that uncommenting

#define ASSEMBLE_REDUCTION_SUBMATRIX 

may give better performance.

Here is gist of the above instructions:
Google colab gist

Good luck and have fun!

@IbtihalFerwana
Copy link

Hello,
thanks for the guide.

at step 5, I face the issue that folder /python is not created in ripser-plusplus. Any hints in that?
FileNotFoundError: [Errno 2] No such file or directory: '/ripser-plusplus/python/bin'

@simonzhang00
Copy link
Owner

These instructions are old, ripser++ has been updated. To install ripser++ just use: pip3 install ripserplusplus or pip3 install git+https://github.com/simonzhang00/ripser-plusplus or clone the repository and follow the instructions in the main README.md.

@sava-1729
Copy link

sava-1729 commented Dec 24, 2021

pip3 install ripserplusplus

Hello,
This still doesn't seem to work. Please check the notebook below for details:
https://github.com/sava-1729/practice/blob/master/ripser.ipynb

Edit:
One needs to enable GPU in the notebook menu:
Runtime -> Change Runtime Type -> Hardware Accelerator -> GPU
And after that it gets installed perfectly. Check the notebook below for details:
https://github.com/sava-1729/practice/blob/master/ripser_with_gpu.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants