ReMAS
1.5
Real-time Musical Accompaniment System
|
File with code of ReMAS functions for Nvidia GPUs. More...
Go to the source code of this file.
Functions | |
unsigned int | NextPow2 (unsigned int x) |
NextPow2 returns the next power of 2 of a given number. More... | |
bool | IsPow2 (unsigned int x) |
IsPow2 decides if a number is power of 2. More... | |
int | HaveCompatibleGPU (int &maxGrid) |
HaveCompatibleGPU checks if the system has an appropiate GPU for ReMAS. More... | |
int | AllocS_fkGPU (MyType **s_fk, MyType **tauxi, MyType **ts_fk, const MyType BETA, const int nmidi, const int nbases, DTWfiles NameFiles) |
AllocS_fkGPU Allocates memory for S_fk vector, read its data from file and initializes other auxiliar vectors. More... | |
int | AllocDataGPU (MyType **v_hanning, int **states_time_i, int **states_time_e, int **states_seq, int **states_corr, int **I_SxD, int *DTWSize, const int tamtrama, const int nstates, DTWfiles NameFiles) |
AllocDataGPU Allocates memory and initializes some structures reading info from files. More... | |
int | AllocFFTGPU (MyFFTGPUType *plan, MyType **X_fft, MyType **Out_fft, MyType **Mod_fft, int *kmin_fft, int *kmax_fft, const int nfft, DTWfiles NameFiles) |
AllocFFTGPU Allocates "Unified" GPU memory for FFT vector and reads some fft information from files. More... | |
int | AllocDTWGPU (MyType **pV, MyType **v_SxD, MyType **sdata, const int maxGrid, const int DTWSize, const int DTWSizePlusPad) |
AllocDTWGPU Allocates memory for DTW vectors and auxiliar structures. More... | |
int | AllocAuxiGPU (MyType **norms, short **GPUframe, short **CPUframe, MyType **v_cfreq, MyType **v_dxState, const int nbases, const int tamframe, const int nmidi) |
AllocAuxiGPU memory reservation for norms, frame, v_cfreq and v_dxState vectors. More... | |
void | BlocksAndThreads (int *blocks, int *threads, int *sharedsize, const int maxGrid, const int size) |
BlocksAndThreads calculates the suitable number of blocks and threads, and the needed shared memory. More... | |
int | FFTGPU (MyType *X_fft, MyType *Out_fft, MyFFTGPUType *plan) |
FFTGPU computes FFT. More... | |
void | InitSxD (MyType *odata, MyType *v_SxD, const MyType *__restrict__ v_dxState, const int *__restrict__ I_SxD, const int maxGrid, const int size) |
InitSxD launches the cuda kernel that sets up the vector SxD when "Unified" GPU memory is used. More... | |
int | OneImin (MyType *odata, int *opos, MyType *idata, const int maxGrid, const int size) |
This function launches cuda kernels to find one minimun and its position. More... | |
int | FirstImin (MyType *odata, int *opos, MyType *idata, const int maxGrid, const int size) |
This function launches cuda kernels to find the first minimun and its position. More... | |
int | LastImin (MyType *odata, int *opos, MyType *idata, const int maxGrid, const int size) |
This function launches cuda kernels to find the last minimun and its position. More... | |
int | ReadWavGPU1st (short *GPUframe, short *CPUframe, FILE *fp) |
ReadWavGPU1st reads first audio (frame) from WAV file when NVIDIA GPU is used. More... | |
int | ReadWavGPU (short *GPUframe, short *CPUframe, FILE *fp) |
ReadFileGPU reads current audio (frame) from WAV file when NVIDIA GPU is used. More... | |
File with code of ReMAS functions for Nvidia GPUs.
Definition in file GPUFunctions.cu.
int AllocAuxiGPU | ( | MyType ** | norms, |
short ** | GPUframe, | ||
short ** | CPUframe, | ||
MyType ** | v_cfreq, | ||
MyType ** | v_dxState, | ||
const int | nbases, | ||
const int | tamframe, | ||
const int | nmidi | ||
) |
AllocAuxiGPU memory reservation for norms, frame, v_cfreq and v_dxState vectors.
norms | (out) Norms vector |
GPUframe | (out) Vector for frames in GPU memory |
CPUframe | (out) Vector for frames in CPU memory |
v_cfreq | (out) v_cfreq vector |
v_dxState | (out) v_dxState vector |
nbases | (in) Number of bases/combinations, sizeof norms and v_dxState |
tamframe | (in) Size of frames in samples |
nmidi | (in) Number of midi notes, v_cfreq size |
Definition at line 259 of file GPUFunctions.cu.
int AllocDataGPU | ( | MyType ** | v_hanning, |
int ** | states_time_i, | ||
int ** | states_time_e, | ||
int ** | states_seq, | ||
int ** | states_corr, | ||
int ** | I_SxD, | ||
int * | DTWSize, | ||
const int | tamtrama, | ||
const int | nstates, | ||
DTWfiles | NameFiles | ||
) |
AllocDataGPU Allocates memory and initializes some structures reading info from files.
v_hanning | (out) v_hanning vector |
states_time_i | (out) states_time_i vector, contains the start-time of each state in frames |
states_time_e | (out) states_time_e vector, contains the end-time of each state in frames |
states_seq | (out) states_seq vector, contains the base/combination that is performed in each state |
states_corr | (out) states_corr vector |
I_SxD | (out) I_SxD vector |
DTWSize | (in) Size of DTW vectors |
tamtrama | (in) Size of frames in samples |
nstates | (in) Number of states |
NameFiles | (in) Struct with the file names |
Definition at line 148 of file GPUFunctions.cu.
int AllocDTWGPU | ( | MyType ** | pV, |
MyType ** | v_SxD, | ||
MyType ** | sdata, | ||
const int | maxGrid, | ||
const int | DTWSize, | ||
const int | DTWSizePlusPad | ||
) |
AllocDTWGPU Allocates memory for DTW vectors and auxiliar structures.
pV | (out) DTW pV vector |
v_SxD | (out) v_SxD vector |
sdata | (out) sdata vector, auxiliar |
maxGrid | (in) maxGridSize supported by GPU |
DTWSize | (in) Size of DTW vectors |
DTWSizePlusPad | (in) Size of DTW vectors plus padding |
Definition at line 232 of file GPUFunctions.cu.
int AllocFFTGPU | ( | MyFFTGPUType * | plan, |
MyType ** | X_fft, | ||
MyType ** | Out_fft, | ||
MyType ** | Mod_fft, | ||
int * | kmin_fft, | ||
int * | kmax_fft, | ||
const int | nfft, | ||
DTWfiles | NameFiles | ||
) |
AllocFFTGPU Allocates "Unified" GPU memory for FFT vector and reads some fft information from files.
plan | (out) FFT scheduler |
X_fft | (out) X_fft vector |
Out_fft | (out) Out_fft vector |
Mod_fft | (out) Mod_fft vector |
kmin_fft | (out) Where kmin_fft is stored |
kmax_fft | (out) Where kmax_fft is stored |
nfft | (in) As is to be, Mod_fft and Out_fft size |
NameFiles | (in) Struct with the file names |
Definition at line 197 of file GPUFunctions.cu.
int AllocS_fkGPU | ( | MyType ** | s_fk, |
MyType ** | tauxi, | ||
MyType ** | ts_fk, | ||
const MyType | BETA, | ||
const int | nmidi, | ||
const int | nbases, | ||
DTWfiles | NameFiles | ||
) |
AllocS_fkGPU Allocates memory for S_fk vector, read its data from file and initializes other auxiliar vectors.
s_fk | (out) s_fk vector |
tauxi | (out) Auxiliar vector tauxi |
ts_fk | (out) Auxiliar vector ts_fk |
BETA | (in) BETA value |
nmidi | (in) Number of midi notes |
nbases | (in) Number of bases/combinations |
NameFiles | (in) Struct with the file names |
Definition at line 117 of file GPUFunctions.cu.
void BlocksAndThreads | ( | int * | blocks, |
int * | threads, | ||
int * | sharedsize, | ||
const int | maxGrid, | ||
const int | size | ||
) |
BlocksAndThreads calculates the suitable number of blocks and threads, and the needed shared memory.
blocks | (out) Number of blocks |
threads | (out) Number of threads |
sharedsize | (out) Size of shared memory |
maxGrid | (in) maxGridSize supported by GPU |
size | (in) Size of the vectors |
Definition at line 283 of file GPUFunctions.cu.
int FFTGPU | ( | MyType * | X_fft, |
MyType * | Out_fft, | ||
MyFFTGPUType * | plan | ||
) |
FFTGPU computes FFT.
X_fft | (inout) X_fft vector |
Out_fft | (inout) Out_fft vector |
plan | (out) FFT scheduler |
Definition at line 307 of file GPUFunctions.cu.
int FirstImin | ( | MyType * | odata, |
int * | opos, | ||
MyType * | idata, | ||
const int | maxGrid, | ||
const int | size | ||
) |
This function launches cuda kernels to find the first minimun and its position.
odata | (inout) Intermedial data vector |
opos | (inout) Intermedial positions vector |
idata | (in) Input data vector |
maxGrid | (in) maxGridSize supported by GPU |
size | (in) Size of the vector |
Definition at line 394 of file GPUFunctions.cu.
int HaveCompatibleGPU | ( | int & | maxGrid | ) |
HaveCompatibleGPU checks if the system has an appropiate GPU for ReMAS.
maxGrid | (out) MaxGrid stores the GPU maxGridSize property |
Definition at line 75 of file GPUFunctions.cu.
void InitSxD | ( | MyType * | odata, |
MyType * | v_SxD, | ||
const MyType *__restrict__ | v_dxState, | ||
const int *__restrict__ | I_SxD, | ||
const int | maxGrid, | ||
const int | size | ||
) |
InitSxD launches the cuda kernel that sets up the vector SxD when "Unified" GPU memory is used.
odata | (inout) Intermedial data vector |
v_SxD | (out) v_SxD vector |
v_dxState | (out) v_dxState vector |
I_SxD | (out) I_SxD vector |
maxGrid | (in) maxGridSize supported by GPU |
size | (in) Size of the vector |
Definition at line 330 of file GPUFunctions.cu.
|
inline |
IsPow2 decides if a number is power of 2.
x | (in) The number |
Definition at line 66 of file GPUFunctions.cu.
int LastImin | ( | MyType * | odata, |
int * | opos, | ||
MyType * | idata, | ||
const int | maxGrid, | ||
const int | size | ||
) |
This function launches cuda kernels to find the last minimun and its position.
odata | (inout) Intermedial data vector |
opos | (inout) Intermedial positions vector |
idata | (in) Input data vector |
maxGrid | (in) maxGridSize supported by GPU |
size | (in) Size of the vector |
Definition at line 426 of file GPUFunctions.cu.
unsigned int NextPow2 | ( | unsigned int | x | ) |
NextPow2 returns the next power of 2 of a given number.
x | (in) The number |
Definition at line 47 of file GPUFunctions.cu.
int OneImin | ( | MyType * | odata, |
int * | opos, | ||
MyType * | idata, | ||
const int | maxGrid, | ||
const int | size | ||
) |
This function launches cuda kernels to find one minimun and its position.
odata | (inout) Intermedial data vector |
opos | (inout) Intermedial positions vector |
idata | (in) Input data vector |
maxGrid | (in) maxGridSize supported by GPU |
size | (in) Size of the vector |
Definition at line 362 of file GPUFunctions.cu.
ReadWavGPU | ( | short * | GPUframe, |
short * | CPUframe, | ||
FILE * | fp | ||
) |
ReadFileGPU reads current audio (frame) from WAV file when NVIDIA GPU is used.
GPUframe | (out) Vector to store the current frame whitin NVIDIA GPU |
CPUframe | (—) Vector to store the current frame whitin ARM |
fp | (in) ID of file with the information |
Definition at line 473 of file GPUFunctions.cu.
ReadWavGPU1st | ( | short * | GPUframe, |
short * | CPUframe, | ||
FILE * | fp | ||
) |
ReadWavGPU1st reads first audio (frame) from WAV file when NVIDIA GPU is used.
GPUframe | (out) Vector to store the first frame within NVIDIA GPU |
CPUframe | (—) Vector to store the first frame within ARM |
fp | (in) ID of file with the information |
Definition at line 456 of file GPUFunctions.cu.