-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrated previous documentation with present doxy documentation
- Loading branch information
Showing
11 changed files
with
420 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,49 @@ | ||
# Doxyfile configuration file | ||
|
||
# Project name and version | ||
PROJECT_NAME = "ApraPipes" | ||
PROJECT_NUMBER = 1.0 | ||
|
||
# The directory where the documentation will be created | ||
OUTPUT_DIRECTORY = ./documentation | ||
|
||
OUTPUT_DIRECTORY = ./documents | ||
# The root directory of the source code | ||
INPUT = ./base | ||
|
||
INPUT = ./base/include ./base/src ./data/gh-pages-assets/pages/index.md ./data/gh-pages-assets/pages/introduction.md ./data/gh-pages-assets/pages/Tutorial_Adding_New_Module.md ./data/gh-pages-assets/pages/CUDAKernelProgrammingGuide.md | ||
# File patterns to include in the documentation | ||
FILE_PATTERNS = *.h *.hpp *.c *.cpp | ||
|
||
FILE_PATTERNS = *.h *.hpp *.c *.cpp *.md | ||
# Exclude directories and files | ||
EXCLUDE = * | ||
|
||
# Recurse through subdirectories | ||
RECURSIVE = YES | ||
|
||
# Generate documentation for all entities | ||
EXTRACT_ALL = YES | ||
|
||
# Strip implementation details from documentation | ||
EXTRACT_PRIVATE = YES | ||
EXTRACT_STATIC = YES | ||
HIDE_UNDOC_MEMBERS = YES | ||
HIDE_UNDOC_CLASSES = YES | ||
|
||
MARKDOWN_SUPPORT = YES | ||
USE_MDFILE_AS_MAINPAGE = index.md | ||
# Configuration options for HTML output | ||
GENERATE_HTML = YES | ||
HTML_OUTPUT = html | ||
HTML_FILE_EXTENSION = .html | ||
HTML_COLORSTYLE_HUE = 220 | ||
HTML_TIMESTAMP = YES | ||
|
||
HTML_FOOTER = footer.html | ||
|
||
|
||
HTML_FOOTER = data/gh-pages-assets/pages/footer.html | ||
# Configuration options for LaTeX output | ||
GENERATE_LATEX = NO | ||
|
||
# Configuration options for Man pages (UNIX specific) | ||
GENERATE_MAN = NO | ||
|
||
LATEX_OUTPUT = latex | ||
|
||
|
||
# Additional include paths | ||
INCLUDE_PATH = | ||
|
||
INCLUDE_PATH = | ||
# Predefined macros | ||
PREDEFINED = | ||
|
||
PREDEFINED = | ||
# Enable collaboration diagram | ||
HAVE_DOT = YES | ||
UML_LOOK = YES | ||
CALL_GRAPH = YES | ||
CALLER_GRAPH = YES | ||
|
||
IMAGE_PATH = data\gh-pages-assets\_images | ||
HTML_EXTRA_STYLESHEET = data/gh-pages-assets/pages/custom.css | ||
SHOW_NAMESPACES = NO | ||
SHOW_FILES = NO |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# CUDA Kernel Programming Guide | ||
|
||
## Performance Guide | ||
Very important and useful. Follow the [CUDA Documentation](https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html) instead of other sources. | ||
|
||
### Coalesced Access to Global Memory | ||
[Coalesced Access to Global Memory](https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html#coalesced-access-to-global-memory) | ||
- Refer OverlayKernel.cu and EffectsKernel.cu | ||
- uchar4 (4 bytes) - 32x32 threads per block - 4x32x32 - 4K bytes | ||
- A big difference - like 2x in Performance | ||
|
||
### Math Library | ||
[NVIDIA CUDA Math API](https://docs.nvidia.com/cuda/cuda-math-api/index.html) | ||
- multiplication use from here | ||
- big difference | ||
|
||
### _ _device_ _ functions | ||
For writing clean/reusable code, I was using _ _device_ _ function - but the Performance dropped by half. So, I started using macros. I didn’t investigate more on why? | ||
|
||
--- | ||
|
||
© Copyright 2020-2024, Apra Labs. | ||
|
192 changes: 192 additions & 0 deletions
192
data/gh-pages-assets/pages/Tutorial_Adding_New_Module.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
|
||
# Adding New Module | ||
|
||
ChangeDetection Module | ||
|
||
- Input is histogram bins | ||
- Output is ChangeDetectionResult | ||
|
||
## Define Module Properties | ||
```cpp | ||
class ChangeDetectionProps: public ModuleProps | ||
{ | ||
public: | ||
ChangeDetectionProps(): ModuleProps() | ||
{ | ||
refWindowLength \= 1; | ||
refDelayLength \= \-1; | ||
insWindowLength \= 1; | ||
threshold \= 1; | ||
compareMethod \= 1; | ||
} | ||
|
||
ChangeDetectionProps(int \_refWindowLength, int \_refDelayLength, int \_insWindowLength, double \_threshold, int \_compareMethod): ModuleProps() | ||
{ | ||
refWindowLength \= \_refWindowLength; | ||
refDelayLength \= \_refDelayLength; | ||
insWindowLength \= \_insWindowLength; | ||
threshold \= \_threshold; | ||
compareMethod \= \_compareMethod; | ||
} | ||
|
||
// All the properties can be updated during run time using setProps | ||
int refWindowLength; | ||
int refDelayLength; | ||
int insWindowLength; | ||
double threshold; | ||
int compareMethod; | ||
|
||
private: | ||
friend class boost::serialization::access; | ||
|
||
template<class Archive\> | ||
void serialize(Archive &ar, const unsigned int version) | ||
{ | ||
ar & boost::serialization::base_object<ModuleProps\>(\*this); | ||
ar & refWindowLength; | ||
ar & refDelayLength; | ||
ar & insWindowLength; | ||
ar & threshold; | ||
ar & compareMethod; | ||
} | ||
}; | ||
``` | ||
## Validating the input and output | ||
```cpp | ||
bool ChangeDetection::validateInputOutputPins() | ||
{ | ||
// one and only 1 array should exist | ||
auto count \= getNumberOfInputsByType(FrameMetadata::ARRAY); | ||
if (count != 1) | ||
{ | ||
LOG_ERROR << "Input pin of type ARRAY is expected."; | ||
return false; | ||
} | ||
// output CHANGE_DETECTION pin should exist | ||
count \= getNumberOfOutputsByType(FrameMetadata::CHANGE_DETECTION); | ||
if (count != 1) | ||
{ | ||
LOG_ERROR << "Input pin of type CHANGE_DETECTION is expected."; | ||
return false; | ||
} | ||
return true; | ||
} | ||
``` | ||
## Initialization | ||
```cpp | ||
bool ChangeDetection::init() | ||
{ | ||
if (!Module::init()) | ||
{ | ||
return false; | ||
} | ||
|
||
// any initialization here | ||
|
||
return true; | ||
} | ||
``` | ||
## Handling the first frame and using the input metadata | ||
```cpp | ||
bool ChangeDetection::processSOS(frame_sp& frame) | ||
{ | ||
auto metadata \= frame\->getMetadata(); | ||
if (metadata\->getFrameType() != FrameMetadata::ARRAY) | ||
{ | ||
return true; | ||
} | ||
|
||
// metadata has width, height, type depending on the frame type | ||
|
||
return true; | ||
} | ||
``` | ||
## Output | ||
```cpp | ||
class ChangeDetectionResult | ||
{ | ||
public: | ||
ChangeDetectionResult(bool changeDetected, double distance, uint64_t index) | ||
{ | ||
mChangeDetected \= changeDetected; | ||
mDistance \= distance; | ||
fIndex \= index; | ||
} | ||
ChangeDetectionResult() {} | ||
static boost::shared_ptr<ChangeDetectionResult\> deSerialize(frame_container& frames) | ||
{ | ||
auto frameType \= FrameMetadata::CHANGE_DETECTION; | ||
auto frame \= frame\_sp(); | ||
for (auto it \= frames.cbegin(); it != frames.cend(); it++) | ||
{ | ||
auto tempFrame \= it\->second; | ||
if (tempFrame\->getMetadata()\->getFrameType() \== frameType) | ||
{ | ||
frame \= tempFrame; | ||
} | ||
} | ||
if (!frame.get()) | ||
{ | ||
return boost::shared\_ptr<ChangeDetectionResult\>(); | ||
} | ||
auto result \= boost::shared\_ptr<ChangeDetectionResult\>(new ChangeDetectionResult(false, 0, 0)); | ||
auto& obj \= \*result.get(); | ||
Utils::deSerialize<ChangeDetectionResult\>(obj, frame\->data(), frame\->size()); | ||
return result; | ||
} | ||
static void serialize(bool changeDetected, double distance, uint64_t index, void\* buffer, size_t size) | ||
{ | ||
auto result \= ChangeDetectionResult(changeDetected, distance, index); | ||
Utils::serialize<ChangeDetectionResult\>(result, buffer, size); | ||
} | ||
static size_t getSerializeSize() | ||
{ | ||
return 1024 + sizeof(mChangeDetected) + sizeof(mDistance) + sizeof(fIndex); | ||
} | ||
bool mChangeDetected; | ||
double mDistance; | ||
uint64_t fIndex; | ||
private: | ||
friend class boost::serialization::access; | ||
template<class Archive\> | ||
void serialize(Archive & ar, const unsigned int /\* file_version \*/) { | ||
ar & mChangeDetected & mDistance & fIndex; | ||
} | ||
}; | ||
``` | ||
## Consuming the input and send output | ||
```cpp | ||
bool ChangeDetection::process(frame_container& frames) | ||
{ | ||
auto inFrame \= getFrameByType(frames, FrameMetadata::ARRAY); | ||
auto metadata \= mDetail\->getOutputMetadata(); | ||
auto outFrame \= makeFrame(ChangeDetectionResult::getSerializeSize(), metadata); | ||
|
||
// do the computation here | ||
|
||
auto pinId \= getOutputPinIdByType(FrameMetadata::CHANGE_DETECTION); | ||
frames.insert(make_pair(pinId, outFrame)); | ||
send(frames); | ||
|
||
return true; | ||
} | ||
``` | ||
--- | ||
© Copyright 2020-2024, Apra Labs. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
Example custom.css | ||
|
||
/* Body styles */ | ||
body { | ||
font-family: 'Comfortaa', Arial, sans-serif; | ||
font-size: 14px; | ||
line-height: 1.6; | ||
color: #333; | ||
background-color: #fff; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
/* Header styles */ | ||
h1, h2, h3 { | ||
color: #0066cc; | ||
} | ||
|
||
/* Link styles */ | ||
a { | ||
color: #0066cc; | ||
text-decoration: none; | ||
} | ||
|
||
a:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
/* Code block styles */ | ||
pre { | ||
background-color: #f8f8f8; | ||
padding: 10px; | ||
overflow-x: auto; | ||
} | ||
|
||
|
||
|
||
th, td { | ||
|
||
padding: 8px; | ||
text-align: left; | ||
} | ||
|
||
th { | ||
background-color: #f2f2f2; | ||
} | ||
|
||
/* Footer styles */ | ||
footer { | ||
margin-top: 20px; | ||
padding: 10px; | ||
background-color: #f2f2f2; | ||
text-align: center; | ||
font-size: 12px; | ||
} | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Welcome to Apra Pipes documentation! | ||
|
||
Contents: | ||
|
||
- [Introduction](introduction.md) | ||
- Design | ||
- Stack | ||
- Libraries | ||
- Core Concepts | ||
- [Adding New Module](Tutorial_Adding_New_Module.md) | ||
- Define Module Properties | ||
- Validating the input and output | ||
- Initialization | ||
- Handling the first frame and using the input metadata | ||
- Output | ||
- Consuming the input and send output | ||
- [CUDA Kernel Programming Guide](CUDAKernelProgrammingGuide.md) | ||
- Performance Guide | ||
|
||
--- | ||
|
||
© Copyright 2020-2024, Apra Labs. | ||
|
Oops, something went wrong.