blob: 8657ed0d82a08354ef7cf806e57edc24ec958301 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This file follows the
# PEP8 Python style guide and uses a max-width of 120 characters per line.
#
# Author(s):
# Cedric Nugteren <www.cedricnugteren.nl>
NL = "\n"
def header():
"""Generates the header for the API documentation"""
result = "CLBlast: API reference" + NL
result += "================" + NL + NL + NL
return result
def generate(routine):
"""Generates the API documentation for a given routine"""
result = ""
# Routine header
result += "x" + routine.name.upper() + ": " + routine.description + NL
result += "-------------" + NL + NL
result += routine.details + NL + NL
# Routine API
result += "C++ API:" + NL
result += "```" + NL
result += routine.routine_header_cpp(12, "") + NL
result += "```" + NL + NL
result += "C API:" + NL
result += "```" + NL
for flavour in routine.flavours:
result += routine.routine_header_c(flavour, 20, "") + NL
result += "```" + NL + NL
# Routine arguments
result += "Arguments to " + routine.name.upper() + ":" + NL + NL
for argument in routine.arguments_doc():
result += "* " + argument + NL
result += "* `cl_command_queue* queue`: "
result += "Pointer to an OpenCL command queue associated with a context and device to execute the routine on." + NL
result += "* `cl_event* event`: "
result += "Pointer to an OpenCL event to be able to wait for completion of the routine's OpenCL kernel(s). "
result += "This is an optional argument." + NL + NL
# Routine requirements
if len(routine.requirements_doc()) > 0:
result += "Requirements for " + routine.name.upper() + ":" + NL + NL
for requirement in routine.requirements_doc():
result += "* " + requirement + NL
result += NL
# Routine footer
result += NL + NL
return result
|