From b24179c865bfe396dbd470184a3f0c03001f43cb Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Mon, 4 Jul 2022 23:13:43 +0800 Subject: [PATCH] Begin to add doc for developers. --- docs/source/installation/code/cmake-out.log | 109 ++++++++++++++++++++ docs/source/installation/for-developers.rst | 72 +++++++++++++ docs/source/installation/index.rst | 1 + 3 files changed, 182 insertions(+) create mode 100644 docs/source/installation/code/cmake-out.log create mode 100644 docs/source/installation/for-developers.rst diff --git a/docs/source/installation/code/cmake-out.log b/docs/source/installation/code/cmake-out.log new file mode 100644 index 000000000..8eb47a99e --- /dev/null +++ b/docs/source/installation/code/cmake-out.log @@ -0,0 +1,109 @@ +-- The C compiler identification is GNU 7.5.0 +-- The CXX compiler identification is GNU 7.5.0 +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working C compiler: /usr/bin/cc - skipped +-- Detecting C compile features +-- Detecting C compile features - done +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ - skipped +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- No CMAKE_BUILD_TYPE given, default to Release +-- Downloading pybind11 +-- pybind11 is downloaded to /root/fangjun/open-source/sherpa/build/_deps/pybind11-src +-- pybind11 v2.9.2 +-- Found PythonInterp: /ceph-fj/fangjun/software/py38/bin/python (found version "3.8") +-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so +-- Performing Test HAS_FLTO +-- Performing Test HAS_FLTO - Success +-- Python executable: /ceph-fj/fangjun/software/py38/bin/python +-- PYTHON_EXECUTABLE: /ceph-fj/fangjun/software/py38/bin/python +-- TORCH_DIR: /ceph-fj/fangjun/software/py38/lib/python3.8/site-packages/torch +-- Looking for pthread.h +-- Looking for pthread.h - found +-- Performing Test CMAKE_HAVE_LIBC_PTHREAD +-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed +-- Looking for pthread_create in pthreads +-- Looking for pthread_create in pthreads - not found +-- Looking for pthread_create in pthread +-- Looking for pthread_create in pthread - found +-- Found Threads: TRUE +-- Found CUDA: /ceph-sh1/fangjun/software/cuda-10.2.89 (found version "10.2") +-- Caffe2: CUDA detected: 10.2 +-- Caffe2: CUDA nvcc is: /ceph-sh1/fangjun/software/cuda-10.2.89/bin/nvcc +-- Caffe2: CUDA toolkit directory: /ceph-sh1/fangjun/software/cuda-10.2.89 +-- Caffe2: Header version is: 10.2 +-- Found CUDNN: /ceph-sh1/fangjun/software/cuda-10.2.89/lib/libcudnn.so +-- Found cuDNN: v8.3.2 (include: /ceph-sh1/fangjun/software/cuda-10.2.89/include, library: /ceph-sh1/fangjun/software/cuda-10.2.89/lib/libcudnn.so) +-- /ceph-sh1/fangjun/software/cuda-10.2.89/lib64/libnvrtc.so shorthash is 08c4863f +-- Automatic GPU detection failed. Building for common architectures. +-- Autodetected CUDA architecture(s): 3.5;5.0;5.2;6.0;6.1;7.0;7.5;7.5+PTX +-- Added CUDA NVCC flags for: -gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_75,code=compute_75 +CMake Warning at /ceph-fj/fangjun/software/py38/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:22 (message): + static library kineto_LIBRARY-NOTFOUND not found. +Call Stack (most recent call first): + /ceph-fj/fangjun/software/py38/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:127 (append_torchlib_if_found) + cmake/torch.cmake:14 (find_package) + CMakeLists.txt:43 (include) + + +-- Found Torch: /ceph-fj/fangjun/software/py38/lib/python3.8/site-packages/torch/lib/libtorch.so +-- TORCH_LIBRARIES: torch;torch_library;/ceph-fj/fangjun/software/py38/lib/python3.8/site-packages/torch/lib/libc10.so;/ceph-sh1/fangjun/software/cuda-10.2.89/lib64/stubs/libcuda.so;/ceph-sh1/fangjun/software/cuda-10.2.89/lib64/libnvrtc.so;/ceph-sh1/fangjun/software/cuda-10.2.89/lib64/libnvToolsExt.so;/ceph-sh1/fangjun/software/cuda-10.2.89/lib64/libcudart.so;/ceph-fj/fangjun/software/py38/lib/python3.8/site-packages/torch/lib/libc10_cuda.so +-- PyTorch version: 1.10.0+cu102 +CMake Warning (dev) at cmake/k2.cmake:39: + Syntax Warning in cmake code at column 52 + + Argument not separated from preceding token by whitespace. +Call Stack (most recent call first): + CMakeLists.txt:44 (include) +This warning is for project developers. Use -Wno-dev to suppress it. + +-- Using environment variable K2_INSTALL_PREFIX: /foo/k2/build_release +-- K2_CMAKE_PREFIX_PATH: /foo/k2/build_release +-- Found k2: /foo/k2/build_release/lib/libk2_torch_api.so +-- K2_FOUND: TRUE +-- K2_INCLUDE_DIRS: /foo/k2/build_release/include +-- K2_LIBRARIES: k2_torch_api;k2_log;k2context;k2fsa +-- K2_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-unused-variable -Wno-strict-overflow +-- K2_CUDA_FLAGS: +-- K2_TORCH_VERSION_MAJOR: 1 +-- K2_TORCH_VERSION_MINOR: 10 +-- K2_WITH_CUDA: OFF +-- K2_CUDA_VERSION: 10.2 +-- K2_VERSION: 1.17 +-- K2_GIT_SHA1: 2565506e1569dcea2eaa2ccc2e6f2e1d875474d1 +-- K2_GIT_DATE: Mon Jul 4 17:45:47 2022 +-- CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-unused-variable -Wno-strict-overflow +-- Downloading googletest +-- googletest is downloaded to /root/fangjun/open-source/sherpa/build/_deps/googletest-src +-- googletest's binary dir is /root/fangjun/open-source/sherpa/build/_deps/googletest-build +CMake Deprecation Warning at build/_deps/googletest-src/CMakeLists.txt:4 (cmake_minimum_required): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. + + +CMake Deprecation Warning at build/_deps/googletest-src/googlemock/CMakeLists.txt:45 (cmake_minimum_required): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. + + +CMake Deprecation Warning at build/_deps/googletest-src/googletest/CMakeLists.txt:56 (cmake_minimum_required): + Compatibility with CMake < 2.8.12 will be removed from a future version of + CMake. + + Update the VERSION argument value or use a ... suffix to tell + CMake that the project does not need compatibility with older versions. + + +-- CMAKE_CXX_FLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 -D_GLIBCXX_USE_CXX11_ABI=0 -Wno-unused-variable -Wno-strict-overflow +-- Configuring done +-- Generating done +-- Build files have been written to: /root/fangjun/open-source/sherpa/build diff --git a/docs/source/installation/for-developers.rst b/docs/source/installation/for-developers.rst new file mode 100644 index 000000000..d1b70795d --- /dev/null +++ b/docs/source/installation/for-developers.rst @@ -0,0 +1,72 @@ +For developers +============== + +As a developer or an advanced user of `sherpa`_, there is no need to use + +.. code-block:: bash + + python3 setup.py install + +or + +.. code-block:: bash + + pip install k2-sherpa + +to install `sherpa`_. + +The above approaches allow you to install only a single version of `sherpa`_ +inside a virtual environment, which is inconvenient if you want to try +several versions of `sherpa`_ in your current virtual environment. + +This section describes how to use `sherpa`_ +from a developer's perspective. + +Install `k2`_ +------------- + +Please refer to ``_ +for how to install `k2`_. + +We assume you have cloned `k2`_ to the directory ``/foo`` +and the build directory of `k2`_ is ``/foo/k2/build_release``. + + +Clone `sherpa`_ +--------------- + +The first thing you need to do is to clone `sherpa`_: + +.. code-block:: bash + + git clone https://github.com/k2-fsa/sherpa + +.. hint:: + + We recommend you to clone your own fork: + + .. code-block:: bash + + git clone git@github.com:your_github_username/sherpa + +Build `sherpa`_ +--------------- + +.. code-block:: bash + + cd sherpa + mkdir build + cd build + export K2_INSTALL_PREFIX=/foo/k2/build_release + cmake .. + +The output of ``cmake ..`` is given below for reference: + +.. literalinclude:: ./code/cmake-out.log + :caption: Output of ``cmake ..`` + +Then you can build `sherpa`_ using: + +.. code-block:: bash + + make -j 5 diff --git a/docs/source/installation/index.rst b/docs/source/installation/index.rst index 5ee8d2f8e..5b0578678 100644 --- a/docs/source/installation/index.rst +++ b/docs/source/installation/index.rst @@ -21,6 +21,7 @@ the one that works best for you. :maxdepth: 2 from-source + for-developers .. |os_types| image:: ./pic/os-brightgreen.svg :alt: Supported operating systems