Commit e0c85c4b authored by cucengineer's avatar cucengineer

cuFFT main ok

parent a07b5eb7
......@@ -724,6 +724,16 @@ int main( int argc, char **argv )
init_opt();
load_cuFFT();
int32_t a[2048] = {1};
int32_t *b = (int32_t *)malloc(2048 * sizeof(int32_t));
int i;
for (i = 0; i < 2048; i++)
{
a[i]= 2048-i;
}
cudft204((int16_t*)a,(int16_t*)b,1);
cudft2048((int16_t*)a,(int16_t*)b,1);
#ifdef PDCP_USE_NETLINK
......
......@@ -441,6 +441,15 @@ int main( int argc, char **argv ) {
init_opt() ;
load_nrLDPClib();
load_cuFFT();
// int16_t a[2048] = {1};
// int16_t *b = (int16_t *)malloc(2048 * sizeof(int16_t));
// int i;
// for (i = 0; i < 2048; i++)
// {
// a[i]= 2048-i;
// }
// cudft2048(a,b,1);
if (ouput_vcd) {
vcd_signal_dumper_init("/tmp/openair_dump_nrUE.vcd");
......
......@@ -56,4 +56,5 @@ typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,sho
\param p_profiler LDPC profiler statistics
*/
typedef int32_t(*nrLDPC_decoderfunc_t)(t_nrLDPC_dec_params* , int8_t*, int8_t* , t_nrLDPC_procBuf* , t_nrLDPC_time_stats* );
typedef void(*cudft_EnTx)(int16_t* , int16_t*, unsigned char );
#endif
\ No newline at end of file
......@@ -23,13 +23,18 @@
#ifdef LDPC_LOADER
nrLDPC_decoderfunc_t nrLDPC_decoder;
nrLDPC_encoderfunc_t nrLDPC_encoder;
cudft_EnTx cudft2048;
cudft_EnTx cudft204;
#else
/* functions to load the LDPC shared lib, implemented in openair1/PHY/CODING/nrLDPC_load.c */
extern int load_nrLDPClib(void) ;
extern int load_nrLDPClib_ref(char *libversion, nrLDPC_encoderfunc_t * nrLDPC_encoder_ptr); // for ldpctest
/* ldpc coder/decoder functions, as loaded by load_nrLDPClib(). */
extern int load_cuFFT(void) ;
extern nrLDPC_decoderfunc_t nrLDPC_decoder;
extern nrLDPC_encoderfunc_t nrLDPC_encoder;
extern cudft_EnTx cudft2048;
extern cudft_EnTx cudft204;
// inline functions:
#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init_mem.h"
#endif
\ No newline at end of file
......@@ -39,6 +39,8 @@
#include "PHY/CODING/nrLDPC_extern.h"
#include "common/config/config_userapi.h"
#include "common/utils/load_module_shlib.h"
#include <dlfcn.h>
/* function description array, to be used when loading the encoding/decoding shared lib */
......@@ -73,4 +75,27 @@ int load_nrLDPClib_ref(char *libversion, nrLDPC_encoderfunc_t * nrLDPC_encoder_p
return 0;
}
int load_cuFFT(void) {
//手动加载指定位置的so动态库
void* handle = dlopen("../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/cuFFT.so", RTLD_LAZY|RTLD_NODELETE|RTLD_GLOBAL);
if(!handle){
printf("open cuFFT.so error!\n");
return -1;
}
//根据动态链接库操作句柄与符号,返回符号对应的地址
cudft2048 = (cudft_EnTx) dlsym(handle, "_Z9cudft2048PsS_h");
if(!cudft2048){
printf("cuFFT.so error!\n");
dlclose(handle);
return -1;
}
cudft204 = (cudft_EnTx) dlsym(handle, "_Z8testtestPsS_h");
if(!cudft204){
printf("cutest.so error!\n");
dlclose(handle);
return -1;
}
return 0;
}
......@@ -10627,6 +10627,17 @@ int dfts_autoinit(void)
void dft(uint8_t sizeidx, int16_t *sigF,int16_t *sig,unsigned char scale_flag){
AssertFatal((sizeidx>=0 && sizeidx<(int)DFT_SIZE_IDXTABLESIZE),"Invalid dft size index %i\n",sizeidx);
dft_ftab[sizeidx](sigF,sig,scale_flag);
static int cu_2048 = 1;
if(sizeidx==DFT_2048 && cu_2048 < 5)
{
cu_2048 ++;
int i;
printf("hs111111111111111111111111111111111111111111111:\n");
for (i = 0; i < 1024; i++)
{
printf("a=%d + %dj\tb=%d + %dj\n", sigF[i*2],sigF[i*2+1],sig[i*2],sig[i*2+1]);
}
}
};
void idft(uint8_t sizeidx, int16_t *sigF,int16_t *sig,unsigned char scale_flag){
......
......@@ -262,6 +262,7 @@ void dft36864(int16_t *x,int16_t *y,uint8_t scale_flag);
void dft49152(int16_t *x,int16_t *y,uint8_t scale_flag);
void dft73728(int16_t *x,int16_t *y,uint8_t scale_flag);
void dft98304(int16_t *x,int16_t *y,uint8_t scale_flag);
extern void cudft2048(int16_t *x,int16_t *y,uint8_t scale_flag);
void idft64(int16_t *x,int16_t *y,uint8_t scale_flag);
......@@ -321,7 +322,7 @@ adftfunc_t dft_ftab[]={
dft512, dft540, dft576, dft600, dft648, dft720, dft768, dft864,
dft900, dft960, dft972, dft1024, dft1080, dft1152, dft1200, dft1296,
dft1440, dft1500, dft1536, dft1620, dft1728, dft1800, dft1920, dft1944,
dft2048, dft2160, dft2304, dft2400, dft2592, dft2700, dft2880, dft2916,
cudft2048, dft2160, dft2304, dft2400, dft2592, dft2700, dft2880, dft2916,
dft3000, dft3072, dft3240, dft4096, dft6144, dft8192, dft9216, dft12288,
dft18432, dft24576, dft36864, dft49152, dft73728, dft98304
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment