Added first version of GPU chunk digamma reduction function.

For now the calculation of the digammas is fully parallel but sums are
done in CPU.
This commit is contained in:
Pedro Martinez Mediano 2017-05-25 00:19:07 +10:00
parent afcfb61260
commit 2d8d0271ca
2 changed files with 26 additions and 0 deletions

View File

@ -341,6 +341,29 @@ int parallelDigammas(float *digammas, int *nx, int *ny, int signallength) {
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
int computeSumDigammasChunks(float *sumDiGammas, int *nx, int *ny,
int triallength, int nchunks) {
int signallength = triallength * nchunks;
float digammas[signallength];
int err = parallelDigammas(digammas, nx, ny, signallength);
for (int c = 0; c < nchunks; c++) {
float sum = 0;
for (int i = 0; i < triallength; i++) {
sum += digammas[triallength*c + i];
}
sumDiGammas[c] = sum;
}
return 1;
}
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -25,6 +25,9 @@ int findRadiiAlgorithm2(float *radii, const float *data, const int *indexes,
int computeSumDigammas(float *sumDiGammas, int *nx, int *ny, unsigned int N);
int computeSumDigammasChunks(float *sumDiGammas, int *nx, int *ny,
int trialLength, int nchunks);
int parallelDigammas(float *digammas, int *nx, int *ny, int signallength);
void device_reset(void);