Skip to content

Commit

Permalink
doc: firts steps towards a structured API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sehoffmann committed Oct 25, 2024
1 parent 39c0720 commit 4e955fe
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/slurm-*.out
/wandb
/doc/_build
/doc/generated/

############################ Auto Generated ############################

Expand Down
29 changes: 29 additions & 0 deletions dmlcloud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
"""
Hello world
"""

from dmlcloud.pipeline import TrainingPipeline
from dmlcloud.stage import Stage, TrainValStage
from dmlcloud.util.distributed import *

__version__ = "0.3.3"

__all__ = [
'TrainingPipeline',
'Stage',
'TrainValStage',
]

# Ditributed helpers
__all__ += [
'has_slurm',
'has_environment',
'has_mpi',
'is_root',
'root_only',
'root_first',
'rank',
'world_size',
'local_rank',
'local_world_size',
'local_node',
'print_worker',
'print_root',
'all_gather_object',
'gather_object',
'broadcast_object',
'init_process_group_dummy',
'init_process_group_slurm',
'init_process_group_MPI',
'init_process_group_auto',
'deinitialize_torch_distributed',
]
24 changes: 24 additions & 0 deletions dmlcloud/util/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@

from .tcp import find_free_port, get_local_ips

__all__ = [
'has_slurm',
'has_environment',
'has_mpi',
'is_root',
'root_only',
'root_first',
'rank',
'world_size',
'local_rank',
'local_world_size',
'local_node',
'print_worker',
'print_root',
'all_gather_object',
'gather_object',
'broadcast_object',
'init_process_group_dummy',
'init_process_group_slurm',
'init_process_group_MPI',
'init_process_group_auto',
'deinitialize_torch_distributed',
]


DEFAULT_PORT = os.environ.get('DMLCLOUD_PORT', 41312) # dml

Expand Down
13 changes: 9 additions & 4 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,27 @@
release = 'v0.3.3'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx.ext.duration',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'sphinx.ext.coverage',
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_logo = '../misc/logo/dmlcloud_light.png'


# Napoleon configs
napoleon_google_docstring = True
napoleon_numpy_docstring = False
napoleon_use_param = False
napoleon_use_rtype = False
napoleon_preprocess_types = True
4 changes: 0 additions & 4 deletions doc/generated/dmlcloud.rst

This file was deleted.

43 changes: 40 additions & 3 deletions doc/reference.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
.. currentmodule:: dmlcloud

API Reference
=========
=============

This the API reference for the dmlcloud package.

.. autosummary::
:toctree: generated

TrainingPipeline
Stage


Initialization
--------------
.. autosummary::
:toctree: generated

init_process_group_dummy
init_process_group_slurm
init_process_group_MPI
init_process_group_auto

This is an automatically generated API reference for the dmlcloud package.

Distributed Helpers
-------------------
.. autosummary::
:toctree: generated

dmlcloud
has_slurm
has_environment
has_mpi
is_root
root_only
root_first
rank
world_size
local_rank
local_world_size
local_node
print_worker
print_root
all_gather_object
gather_object
broadcast_object

0 comments on commit 4e955fe

Please sign in to comment.