NVIDIA / fsi-samples

A collection of open-source GPU accelerated Python tools and examples for quantitative analyst tasks and leverages RAPIDS AI project, Numba, cuDF, and Dask.
271 stars 115 forks source link

[QST] Upgrade gquant_plugin's rapids dependency to v21.x? #153

Closed complyue closed 2 years ago

complyue commented 2 years ago

At time of writing, gquant_plugin assumes rapids=0.19:

https://github.com/NVIDIA/fsi-samples/blob/main/gQuant/plugins/gquant_plugin/README.md#install-the-external-example-plugin

Install RAPIDS: conda install -y -c rapidsai -c nvidia -c conda-forge -c defaults rapids=0.19

I tried to create a virtual env for rapids=0.19 with conda create -n fsi -c rapidsai -c nvidia -c conda-forge rapids=0.19 cudatoolkit, but conda just can't solve it even after several hours of running.


Blindly tried with CUDA 11.5 and rapids 21.12, jupyter-lab just won't start.

$ conda list | grep rapids
# packages in environment at /workspace/anaconda3/envs/rapids:
cucim                     21.12.00        cuda_11_py37_g6d1f082_0    rapidsai
cudf                      21.12.02        cuda_11_py37_g06540b9b37_0    rapidsai
cudf_kafka                21.12.02        py37_g06540b9b37_0    rapidsai
cugraph                   21.12.00        cuda11_py37_g3a43e9d0_0    rapidsai
cuml                      21.12.00        cuda11_py37_g04c4927f3_0    rapidsai
cusignal                  21.12.00        py37_g2bf865c_0    rapidsai
cuspatial                 21.12.00        py37_gab6748f_0    rapidsai
custreamz                 21.12.02        py37_g06540b9b37_0    rapidsai
cuxfilter                 21.12.00        py37_g2e0fb5a_0    rapidsai
dask-cuda                 21.12.00                 py37_0    rapidsai
dask-cudf                 21.12.02        cuda_11_py37_g06540b9b37_0    rapidsai
faiss-proc                1.0.0                      cuda    rapidsai
libcucim                  21.12.00        cuda11_g6d1f082_0    rapidsai
libcudf                   21.12.02        cuda11_g06540b9b37_0    rapidsai
libcudf_kafka             21.12.02          g06540b9b37_0    rapidsai
libcugraph                21.12.00        cuda11_g3a43e9d0_0    rapidsai
libcuml                   21.12.00        cuda11_g04c4927f3_0    rapidsai
libcuspatial              21.12.00        cuda11_gab6748f_0    rapidsai
librmm                    21.12.00        cuda11_g957ad04_0    rapidsai
libxgboost                1.5.0dev.rapidsai21.12      cuda11.2_0    rapidsai
ptxcompiler               0.2.0            py37h81e21aa_0    rapidsai
py-xgboost                1.5.0dev.rapidsai21.12  cuda11.2py37_0    rapidsai
rapids                    21.12.00        cuda11.5_py37_gc46440c_94    rapidsai
rapids-xgboost            21.12.00        cuda11.5_py37_gc46440c_94    rapidsai
rmm                       21.12.00        cuda11_py37_g957ad04_0_has_cma    rapidsai
ucx                       1.11.2+gef2bbcf      cuda11.2_0    rapidsai
ucx-proc                  1.0.0                       gpu    rapidsai
ucx-py                    0.23.0          py37_gef2bbcf_0    rapidsai
xgboost                   1.5.0dev.rapidsai21.12  cuda11.2py37_0    rapidsai
$ MODULEPATH=$PWD/modules jupyter-lab --allow-root --ip=0.0.0.0 --no-browser --NotebookApp.token=''
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/notebookapp.py:73: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  _("Don't open the notebook in a browser after startup.")
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/notebookapp.py:89: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  _("Allow the notebook to be run from root user.")
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/traits.py:20: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  help=_('Deprecated: Use minified JS file or not, mainly use during dev to avoid JS recompilation'),
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/traits.py:25: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  help=_("Supply extra arguments that will be passed to Jinja environment."))
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/traits.py:29: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  help=_("Extra variables to supply to jinja templates when rendering."),
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/traits.py:62: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  help=_("""Path to search for custom.js, css""")
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/traits.py:76: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  Can be used to override templates from notebook.templates.""")
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/traits.py:85: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  help=_("""extra paths to look for Javascript notebook extensions""")
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/traits.py:130: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  help=_("""The MathJax.js configuration file that is to be used.""")
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/traits.py:143: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  help=(_("Dict of Python modules to load as notebook server extensions."
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/notebookapp.py:124: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  This launches a Tornado based HTML Notebook Server that serves up an HTML5/Javascript Notebook client.""")
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/notebookapp.py:143: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  help=_("""Path to search for custom.js, css""")
/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/notebookapp.py:155: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
  help=_("""extra paths to look for Javascript notebook extensions""")
NumExpr defaulting to 8 threads.
[I 2022-01-14 21:40:27.832 ServerApp] greenflowlab | extension was successfully linked.
[I 2022-01-14 21:40:27.832 ServerApp] jupyter_server_proxy | extension was successfully linked.
[W 2022-01-14 21:40:27.836 LabApp] 'token' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[I 2022-01-14 21:40:27.842 ServerApp] jupyterlab | extension was successfully linked.
[W 2022-01-14 21:40:27.857 ServerApp] 'ExtensionManager' object has no attribute '_extensions'
Traceback (most recent call last):
  File "/workspace/anaconda3/envs/rapids/bin/jupyter-lab", line 10, in <module>
    sys.exit(main())
  File "/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/jupyter_server/extension/application.py", line 567, in launch_instance
    serverapp = cls.initialize_server(argv=args)
  File "/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/jupyter_server/extension/application.py", line 540, in initialize_server
    find_extensions=find_extensions,
  File "/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/traitlets/config/application.py", line 88, in inner
    return method(app, *args, **kwargs)
  File "/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/jupyter_server/serverapp.py", line 2315, in initialize
    point = self.extension_manager.extension_points[starter_extension]
  File "/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/jupyter_server/extension/manager.py", line 303, in extension_points
    for value in self.extensions.values()
  File "/workspace/anaconda3/envs/rapids/lib/python3.7/site-packages/nbclassic/nbserver.py", line 80, in extensions
    nb = self._extensions.get("nbclassic")
AttributeError: 'ExtensionManager' object has no attribute '_extensions'
avolkov1 commented 2 years ago

Refer to: https://github.com/NVIDIA/fsi-samples/blob/main/gQuant/docker/build.sh

That will setup a docker container. But if you want to manually set up conda with gquant plugin run something like this:

export RAPIDS_VERSION=21.06
export RAPIDS_CUDA_VER=11.2

conda install -y mamba -n base -c conda-forge
mamba install -y -c rapidsai -c nvidia -c conda-forge -c defaults \
      rapids=$RAPIDS_VERSION cudatoolkit=$RAPIDS_CUDA_VER python=3.8 && \
    conda clean --all -y

mamba install -y -c conda-forge -c defaults \
      jupyterlab'>=3.0.0' jupyter-packaging'>=0.9.2' jupyterlab-system-monitor \
      nodejs=12.4.0 python-graphviz pydot ruamel.yaml && \
    conda clean --all -y && \
    jlpm cache clean && \
    jupyter lab clean

pip install bqplot==0.12.21 && \
    jlpm cache clean && \
    jupyter lab clean

# either git checkout the repo and then pip install
cd greenflowlab && pip install .
# or install from PyPi https://pypi.org/project/greenflowlab/
pip install greenflowlab

# greenflowlab will install greenflow as well.

# plugins are here https://github.com/NVIDIA/fsi-samples/tree/main/gQuant/plugins
# cd to each directory and install
cd gQuant/plugins/gquant_plugin
pip install .

# or from PyPi: https://pypi.org/project/greenflow-gquant-plugin/
pip install greenflow-gquant-plugin

Above I extracted parts from the dockerfile build script. Modify that to use a named conda environment if you prefer instead of installing everything into base conda environment.

We use mamba instead of conda to resolve dependencies in conda. Conda dependency resolution is very slow or broken. Also, we have not tested with Cuda 11.5 and the very latest Rapids. It might work with latest versions, but we haven't verified. Please use Cuda 11.2 and Rapids 21.06. Those were the latest versions we tested with.

complyue commented 2 years ago

Like a charm, I confirm that jupyter-lab works for me this way! Thanks.