Skip to content

Commit be4f82b

Browse files
authored
Merge pull request #36 from ewanwm/feature_improve_doxygen
Feature improve doxygen
2 parents 671de1e + 6c36891 commit be4f82b

10 files changed

+98
-26
lines changed

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
12
<a name="nutens"></a>
2-
# <img src="doc/nuTens-logo.png" alt="nuTens" class="right" align="top" width="400"/>
3+
# nuTens
4+
<img src="nuTens-logo.png" alt="nuTens" align="right" width="400"/>
5+
36

47
nuTens is a software library which uses [tensors](https://en.wikipedia.org/wiki/Tensor_(machine_learning)) to efficiently calculate neutrino oscillation probabilities.
58

doc/doxygen.config

+2-2
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ EXAMPLE_RECURSIVE = NO
966966
# that contain images that are to be included in the documentation (see the
967967
# \image command).
968968

969-
IMAGE_PATH =
969+
IMAGE_PATH = ./doc
970970

971971
# The INPUT_FILTER tag can be used to specify a program that doxygen should
972972
# invoke to filter for each input file. Doxygen will invoke the filter program
@@ -1223,7 +1223,7 @@ HTML_EXTRA_STYLESHEET = doc/tweaks.css
12231223
# files will be copied as-is; there are no commands or markers available.
12241224
# This tag requires that the tag GENERATE_HTML is set to YES.
12251225

1226-
HTML_EXTRA_FILES =
1226+
HTML_EXTRA_FILES = nuTens-logo.png
12271227

12281228
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
12291229
# will adjust the colors in the style sheet and background images according to
File renamed without changes.

nuTens/instrumentation.hpp

+72-21
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66
#include <string>
77
#include <thread>
88
#include <utility>
9-
/*! \file instrumentation.hpp
10-
\brief Define utilities for instrumentation of the code
119

12-
This is the home of anything that gets placed inside other classes or functions in order to instrument the code.
13-
e.g. for profiling or debugging. Everything should ideally be macro-fied so it can be included only for certain
14-
builds, or specified by build time options.
15-
*/
10+
/*!
11+
* @file instrumentation.hpp
12+
* @brief Define utilities for instrumentation of the code
13+
*
14+
* This is the home of anything that gets placed inside other classes or functions in order to instrument the code.
15+
* e.g. for profiling or debugging. Everything should ideally be macro-fied so it can be included only for certain
16+
* builds, or specified by build time options.
17+
*/
1618

1719
struct ProfileResult
1820
{
21+
/// @struct ProfileResult
1922
/// @brief Hold the results of a profiled function to be written out.
2023

2124
std::string name;
@@ -26,21 +29,64 @@ struct ProfileResult
2629

2730
class ProfileWriter
2831
{
29-
/*! @class ProfileWriter
32+
/*!
33+
* @class ProfileWriter
3034
* @brief Singleton class to collect timing information for functions and write out to a file that can be inspected
3135
* later with visual profiling tool
3236
*
3337
* Writes out profiling information in a json format readable by chrome tracing
3438
* (https://www.chromium.org/developers/how-tos/trace-event-profiling-tool/) Use the macros provided to instrument
35-
* the code like: \code{.cpp}
39+
* the source code like:
40+
*
41+
* @code{.cpp}
42+
* \\ header.hpp
43+
*
44+
* class ClassName
45+
* {
46+
* returnType func(args);
47+
* }
48+
*
49+
*
50+
* \\ implementation.cpp
51+
*
52+
* ClassName::func(args)
53+
* {
54+
* NT_PROFILE();
55+
*
56+
* \\ implementation code
57+
*
58+
* }
59+
* @endcode
60+
*
61+
* In order to instantiate the ProfileWriter in an application you will then need to use NT_PROFILE_BEGINSESSION()
62+
* and NT_PROFILE_ENDSESSION() like:
63+
*
64+
* @code{.cpp}
65+
*
66+
* \\ application.cpp
67+
*
68+
* void main()
69+
* {
70+
* NT_PROFILE_BEGINSESSION(sessionName);
3671
*
37-
* \code{.cpp}
72+
* \\ ... code ...
73+
* ClassName instance;
3874
*
39-
* Then open up your favourite chromium based browser and go to chrome://tracing. You can then just drag and drop
40-
* the profiling json file and should see a lovely display of the collected profile information.
75+
* instance.func(args);
76+
*
77+
* \\ ... code ...
78+
*
79+
* NT_PROFILE_ENDSSION();
80+
* }
81+
*
82+
* @endcode
83+
*
84+
* This will save a json file called <sessionName>-profile.json.
85+
* Then you can open up your favourite chromium based browser and go to chrome://tracing. You can then just drag and
86+
* drop the profiling json file and should see a lovely display of the collected profile information.
4187
*/
4288

43-
/// \todo currently only suppor the format used by chrome tracing. Would be nice to support other formats too.
89+
/// @todo currently only suppor the format used by chrome tracing. Would be nice to support other formats too.
4490
/// Should just be a case of adding additional option for writeProfile and header and footer
4591

4692
public:
@@ -120,18 +166,21 @@ class ProfileWriter
120166
};
121167

122168
class InstrumentationTimer
123-
/*!
124-
* @class InstrumentationTimer
125-
* @brief Class to perform the actual timing
126-
*
127-
*
128-
*
129-
*/
130169
{
170+
/*!
171+
* @class InstrumentationTimer
172+
* @brief Class to perform timing
173+
*
174+
* Gets created at the start of the scope to time then will be deleted when the scope ends.
175+
* When deleted, will write out timing information to the output stream defined by ProfileWriter.
176+
*
177+
*
178+
*/
179+
131180
public:
132181
/// @brief Construct an InstrumentationTimer object and start the clock
133-
/// @param[in] name The name of the profile. Typically use __FUNCSIG__ so it's clear which part of the code is being
134-
/// profiled.
182+
/// @param[in] name The name of the profile. Typically use __PRETTY_FUNCTION__ so it's clear which part of the code
183+
/// is being profiled.
135184
InstrumentationTimer(std::string name) : _name(std::move(name)), _stopped(false)
136185
{
137186
_startTimepoint = std::chrono::high_resolution_clock::now();
@@ -182,6 +231,7 @@ class InstrumentationTimer
182231
#endif
183232

184233
/// @brief Profile the current scope
234+
/// Shold always be used at the very start of the scope.
185235
#ifdef USE_PROFILING
186236
// NOLINTNEXTLINE
187237
#define NT_PROFILE() InstrumentationTimer timer##__LINE__(std::string(__PRETTY_FUNCTION__))
@@ -190,6 +240,7 @@ class InstrumentationTimer
190240
#endif
191241

192242
/// @brief End the profiling session
243+
/// Should be used at the very end of an application, after all functions containing a NT_PROFILE() have been called
193244
#ifdef USE_PROFILING
194245
// NOLINTNEXTLINE
195246
#define NT_PROFILE_ENDSESSION() ProfileWriter::get().endSession()

nuTens/propagator/base-matter-solver.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <nuTens/instrumentation.hpp>
44
#include <nuTens/tensors/tensor.hpp>
55

6+
/// @file base-matter-solver.hpp
7+
68
class BaseMatterSolver
79
{
810
/// @class BaseMatterSolver

nuTens/propagator/const-density-solver.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include <nuTens/propagator/base-matter-solver.hpp>
44
#include <nuTens/propagator/constants.hpp>
55

6+
/// @file const-density-solver.hpp
7+
68
class ConstDensityMatterSolver : public BaseMatterSolver
79
{
810
/*!

nuTens/propagator/constants.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

3-
/// @file constant.hpp
3+
/// @file constants.hpp
4+
/// @brief Defines constants to be used across the project
45

5-
//! Define constants to be used across the project
66
namespace Constants
77
{
88

nuTens/propagator/propagator.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <nuTens/tensors/tensor.hpp>
66
#include <vector>
77

8+
/// @file propagator.hpp
9+
810
class Propagator
911
{
1012
/*!

nuTens/tensors/dtypes.hpp

+7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
#pragma once
22

3+
/*!
4+
* @file dtypes.hpp
5+
* @brief Defines various datatypes used in the project
6+
*/
7+
38
namespace NTdtypes
49
{
510

11+
/// Types of scalar values
612
enum scalarType
713
{
814
kInt,
@@ -12,6 +18,7 @@ enum scalarType
1218
kComplexDouble,
1319
};
1420

21+
/// Devices that a Tensor can live on
1522
enum deviceType
1623
{
1724
kCPU,

nuTens/tensors/tensor.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
#include <torch/torch.h>
1414
#endif
1515

16+
/*!
17+
* @file tensor.hpp
18+
* @brief Defines the interface of a Tensor object
19+
*/
20+
1621
class Tensor
1722
{
1823
/*!

0 commit comments

Comments
 (0)