Skip to content

Commit 1fe8899

Browse files
amd-jnovotnyamcamd
authored andcommitted
Refactor hipBLAS documentation (#950)
* Initial draft. Requires more work before push * Refactor remaining files and additional edits * Apply suggestions from team review * Fix errors in API reference * Incorporate comments from review * A few additional edits
1 parent 82e29e4 commit 1fe8899

13 files changed

+951
-893
lines changed

docs/clients.rst

Lines changed: 0 additions & 112 deletions
This file was deleted.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
.. meta::
2+
:description: Documentation of the hipBLAS library source code organization
3+
:keywords: hipBLAS, rocBLAS, BLAS, ROCm, API, Linear Algebra, documentation, library, organization
4+
5+
.. _hipblas-orga:
6+
7+
**********************************
8+
Library source code organization
9+
**********************************
10+
11+
The hipBLAS code is split into the following sections:
12+
13+
* The ``library`` directory, which contains all source code for the library
14+
* The ``clients`` directory, which contains all test code and the code to build clients
15+
* Infrastructure
16+
17+
The library directory
18+
--------------------------
19+
20+
The ``library`` directory includes the following subdirectories.
21+
22+
library/include
23+
^^^^^^^^^^^^^^^^^
24+
25+
Contains C98 include files for the external API. These files include Doxygen
26+
comments that document the API.
27+
28+
library/src/amd_detail
29+
^^^^^^^^^^^^^^^^^^^^^^^^^
30+
31+
Implementation of the hipBLAS interface, which is compatible with the rocBLAS APIs.
32+
33+
library/src/nvidia_detail
34+
^^^^^^^^^^^^^^^^^^^^^^^^^
35+
36+
Implementation of the hipBLAS interface, which is compatible with the cuBLAS-v2 APIs.
37+
38+
library/src/include
39+
^^^^^^^^^^^^^^^^^^^^^^^^^
40+
41+
Internal include files for converting C++ exceptions to hipBLAS statuses.
42+
43+
The clients directory
44+
-----------------------
45+
46+
The ``clients`` directory includes the following subdirectories.
47+
48+
clients/gtest
49+
^^^^^^^^^^^^^^^^^^^^^^^^^
50+
51+
Code for the hipblas-test client. This client is used to test hipBLAS. For
52+
more information, see :ref:`hipblas-clients`.
53+
54+
clients/benchmarks
55+
^^^^^^^^^^^^^^^^^^^^^^^^^
56+
57+
Code for the hipblas-bench client. This client is used to benchmark hipBLAS functions.
58+
For more information, see :ref:`hipblas-clients`.
59+
60+
clients/include
61+
^^^^^^^^^^^^^^^^^^^^^^^^^
62+
63+
Code for testing and benchmarking individual hipBLAS functions and utility code for testing.
64+
65+
clients/common
66+
^^^^^^^^^^^^^^^^^^^^^^^^^
67+
68+
Common code used by both hipblas-bench and hipblas-test.
69+
70+
clients/samples
71+
^^^^^^^^^^^^^^^^^^^^^^^^^
72+
73+
Sample code demonstrating how to call hipBLAS functions.
74+
75+
Infrastructure
76+
--------------
77+
78+
The following utilities support the hipBLAS infrastructure:
79+
80+
* CMake is used to build and package hipBLAS. There are ``CMakeLists.txt`` files throughout the code.
81+
* Doxygen, Breathe, Sphinx, and ReadTheDocs generate the documentation. The following sources supply
82+
content for the documentation:
83+
84+
* Doxygen comments in the include files in the ``library/include`` directory
85+
* Files in the ``docs`` directory
86+
87+
* Jenkins is used to automate continuous integration (CI) testing.
88+
* clang-format is used to format C++ code.

docs/contributing.rst

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
.. meta::
2+
:description: How to contribute to hipBLAS
3+
:keywords: hipBLAS, rocBLAS, BLAS, ROCm, API, contribution
4+
5+
.. _contribute:
6+
7+
********************************************************************
8+
Contributing to hipBLAS
9+
********************************************************************
10+
11+
This topic explains how to contribute to the hipBLAS code base, including coding
12+
and pull request (PR) guidelines and information about static code analysis.
13+
14+
Pull request guidelines
15+
=======================
16+
17+
The hipBLAS code contribution guidelines closely follow the `GitHub
18+
pull requests <https://help.github.com/articles/using-pull-requests/>`__ model.
19+
The hipBLAS repository follows a workflow that dictates a ``release`` branch, from which releases are cut, and a
20+
``develop`` branch, which serves as an integration branch for new code. Pull requests should
21+
adhere to these guidelines:
22+
23+
* Target the **develop** branch for integration.
24+
* Ensure code builds successfully.
25+
* Do not break existing test cases.
26+
* New unit tests should integrate with the existing GoogleTest framework.
27+
* Tests must have good code coverage.
28+
29+
Coding guidelines:
30+
==================
31+
32+
* Don't use unnamed namespaces inside of header files.
33+
* Use either ``template`` or ``inline`` (or both) for functions defined outside of classes in header files.
34+
* Do not declare namespace-scope (not ``class``-scope) functions ``static`` inside of header files
35+
unless:
36+
37+
* There is a very good reason.
38+
* The function does not have any non-``const`` ``static`` local variables.
39+
* It is acceptable that each compilation unit will have its own independent definition of the function and
40+
its ``static`` local variables.
41+
42+
.. note::
43+
44+
``static`` ``class`` member functions defined in header files are okay.
45+
46+
* Use ``static`` for ``constexpr`` ``template`` variables until C++17. After C++17,
47+
``constexpr`` variables become ``inline`` variables and can be defined in multiple compilation units.
48+
It is okay if the ``constexpr`` variables remain ``static`` in C++17, but it means there might
49+
be some redundancy between compilation units.
50+
51+
Code format
52+
-----------
53+
54+
C and C++ code is formatted using ``clang-format``. To run ``clang-format``,
55+
use the version in the ``/opt/rocm/llvm/bin`` directory. Don't use your
56+
system's built-in ``clang-format``, because it might be an older version that
57+
could generate different results.
58+
59+
To format a file, use:
60+
61+
::
62+
63+
/opt/rocm/llvm/bin/clang-format -style=file -i <path-to-source-file>
64+
65+
To format all files, run the following script in hipBLAS directory:
66+
67+
::
68+
69+
#!/bin/bash
70+
git ls-files -z *.cc *.cpp *.h *.hpp *.cl *.h.in *.hpp.in *.cpp.in | xargs -0 /opt/rocm/llvm/bin/clang-format -style=file -i
71+
72+
The githooks application can also be installed to format the code on a per-commit basis:
73+
74+
::
75+
76+
./.githooks/install
77+
78+
Static code analysis
79+
=====================
80+
81+
``cppcheck`` is an open-source static analysis tool. hipBLAS uses this tool to perform static code analysis.
82+
83+
Use the following command to run ``cppcheck`` locally and generate the report for all files.
84+
85+
.. code:: bash
86+
87+
$ cd hipBLAS
88+
$ cppcheck --enable=all --inconclusive --library=googletest --inline-suppr -i./build --suppressions-list=./CppCheckSuppressions.txt --template="{file}:{line}: {severity}: {id} :{message}" . 2> cppcheck_report.txt
89+
90+
For more information on the ``cppcheck`` command line options, see the `cppcheck <http://cppcheck.net/>`_ manual.

0 commit comments

Comments
 (0)