Skip to content

Commit

Permalink
fixed documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
benja263 committed Jun 27, 2024
1 parent 0a4c0c8 commit bfed27a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,15 @@ if (USE_CUDA AND NOT APPLE)
set(USE_CUDA OFF)
endif()
endif()
if(USE_CUDA)

if(NOT USE_CUDA)
message(STATUS "Compiling for CPU only")
else()
message(STATUS "CUDA found, compiling for CPU and GPU")
endif()
# Find required packages
# Attempt to find pybind11 automatically
find_package(pybind11 CONFIG QUIET)

# If pybind11 is not found, use Python to find it
if(NOT pybind11_FOUND)
message(STATUS "pybind11 not found automatically, attempting to locate with Python")
Expand Down Expand Up @@ -155,7 +157,6 @@ endif()

# Include directories
include_directories(${pybind11_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/gbrl/src/cpp)

# Graphviz
if (GRAPHVIZ_FOUND)
add_definitions(-DUSE_GRAPHVIZ)
Expand Down Expand Up @@ -198,7 +199,6 @@ set(CPP_SOURCES

pybind11_add_module(gbrl_cpp MODULE ${CPP_SOURCES} ${CUDA_SOURCES})
target_compile_definitions(gbrl_cpp PRIVATE MODULE_NAME="gbrl_cpp")

# Platform-specific settings and linking
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(gbrl_cpp PRIVATE OpenMP::OpenMP_CXX)
Expand Down
14 changes: 12 additions & 2 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Quickstart
==========

Prerequisites
-----------
-------------

python3.9 or higher

Expand Down Expand Up @@ -49,7 +49,17 @@ After installation, set the necessary environment variables:
CUDA
~~~~

Ensure that ``CUDA_HOME`` is set.
GBRL compiles CUDA and requires NVCC. Ensure that ``CUDA_HOME`` is set. Verify that NVCC exists by running the command

.. code-block:: console
nvcc --version
.. note::

CUDA installation via anaconda may not install the full CUDAToolkit.
Run ``conda install cuda -c nvidia`` to install the full CUDAToolkit.

For integration with Microsoft Visual Studio, copy the following files:

.. code-block:: console
Expand Down
12 changes: 6 additions & 6 deletions gbrl/src/cpp/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ TreeNode::TreeNode(int *sample_indices, const int n_samples, const int n_num_fea
sample_indices(sample_indices), n_samples(n_samples), n_num_features(n_num_features), n_cat_features(n_cat_features),
output_dim(output_dim), policy_dim(policy_dim), depth(depth), node_idx(node_idx), feature_value(0.0),
feature_idx(0){
if (depth > 0){
this->split_conditions = new splitCondition[depth];
for (int d = 0; d < depth; d++){
this->split_conditions[d].categorical_value = nullptr;
}
}
if (depth > 0){
this->split_conditions = new splitCondition[depth];
for (int d = 0; d < depth; d++){
this->split_conditions[d].categorical_value = nullptr;
}
}
}

TreeNode::~TreeNode(){
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import subprocess
import setuptools
import platform
import shutil
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from distutils import log
Expand Down Expand Up @@ -30,6 +31,11 @@ def finalize_options(self):
self.cmake_verbose = os.getenv('DEBUG', '0') == '1'

def run(self):
for folder_name in ['build', 'dist', 'gbrl.egg-info']:
folder_path = os.path.join(os.path.dirname(__file__), folder_name)
if os.path.exists(folder_path):
log.info(f"Cleaning up existing '{folder_name}' folder...")
shutil.rmtree(folder_path)
try:
subprocess.check_output(['cmake', '--version'])
except OSError:
Expand All @@ -46,7 +52,7 @@ def build_extension(self, ext):
'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
'-DPYTHON_EXECUTABLE=' + sys.executable,
'-DPYTHON_INCLUDE_DIR=' + sysconfig.get_path('include'),
'-DCMAKE_BUILD_TYPE=' + cfg
'-DCMAKE_BUILD_TYPE=' + cfg,
]
if sysconfig.get_config_var('LIBRARY') is not None:
cmake_args.append('-DPYTHON_LIBRARY=' + sysconfig.get_config_var('LIBRARY'))
Expand Down Expand Up @@ -108,5 +114,4 @@ def move_built_library(self, build_temp):
},
packages=['gbrl'],
include_package_data=True,
# packages=setuptools.find_packages(where='gbrl'),
)

0 comments on commit bfed27a

Please sign in to comment.