Skip to content

Commit 0e2bf4b

Browse files
committed
Note about REAL type
1 parent 85524d0 commit 0e2bf4b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/customization.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,28 @@ of model parameters and dimensions must be specified as well.
2828
Detailed step by step instructions for adding a model function are given below.
2929

3030
1. Define an additional model ID in file constants.h_. When using the language bindings, the model ID must also be added for Python (in gpufit.py), Matlab (in ModelID.m), Java (in Model.java).
31-
2. Implement a CUDA device function within a newly created .cuh file in folder Gpufit/Gpufit/models according to the following template.
31+
2. Implement a CUDA device function within a newly created .cuh file in folder Gpufit/Gpufit/models according to the following template. (The REAL type is defined in Gpufit/definitions.h to switch between single and double precision.)
3232

3333
.. code-block:: cuda
3434
3535
__device__ void ... ( // ... = function name
36-
float const * parameters,
36+
REAL const * parameters,
3737
int const n_fits,
3838
int const n_points,
39-
float * value,
40-
float * derivative,
39+
REAL * value,
40+
REAL * derivative,
4141
int const point_index,
4242
int const fit_index,
4343
int const chunk_index,
4444
char * user_info,
4545
std::size_t const user_info_size)
4646
{
47-
///////////////////////////// value //////////////////////////////
47+
// value
4848
4949
value[point_index] = ... ; // formula calculating fit model values
5050
51-
/////////////////////////// derivative ///////////////////////////
52-
float * current_derivative = derivative + point_index;
51+
// derivative
52+
REAL * current_derivative = derivative + point_index;
5353
5454
current_derivative[0 * n_points] = ... ; // formula calculating derivative values with respect to parameters[0]
5555
current_derivative[1 * n_points] = ... ; // formula calculating derivative values with respect to parameters[1]

0 commit comments

Comments
 (0)