This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320C6678用OpenMP开发的时候关于用TSCH 和TSCL计算程序运行时间的时候出现“负数”以及出现#554-D: exception specification is not allowed

问题一:我用的是OpenMP多核跑程序,但是出现了如下的warning


**** Build of configuration Debug for project Multi-Core-32 ****

C:\ti\ccsv5\utils\bin\gmake -k all
'Building file: ../main.cpp'
'Invoking: C6000 Compiler'
"C:/c6000_7.4.23/bin/cl6x" -mv6600 --abi=eabi -g --include_path="C:/c6000_7.4.23/include" --diag_wrap=off --display_error_number --diag_warning=225 --openmp --preproc_with_compile --preproc_dependency="main.pp" --cmd_file="./configPkg/compiler.opt" "../main.cpp"
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 88: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 89: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 90: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 91: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 92: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 94: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 96: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 97: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 99: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 100: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 102: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 103: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 104: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 105: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 106: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 108: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 109: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 110: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 111: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 112: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 114: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 115: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 117: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 118: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 119: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 120: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 121: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 122: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 123: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 124: warning #554-D: exception specification is not allowed
"C:/ti/omp_1_01_03_02/packages/ti/omp/omp.h", line 125: warning #554-D: exception specification is not allowed
'Finished building: ../main.cpp'
' '
'Building target: Multi-Core-32.out'
'Invoking: C6000 Linker'
"C:/c6000_7.4.23/bin/cl6x" -mv6600 --abi=eabi -g --diag_wrap=off --display_error_number --diag_warning=225 --openmp -z -m"Multi-Core-32.map" -i"C:/c6000_7.4.23/lib" -i"C:/c6000_7.4.23/include" --reread_libs --display_error_number --warn_sections --diag_wrap=off --rom_model -o "Multi-Core-32.out" -l"./configPkg/linker.cmd" "./main.obj" -l"libc.a"
<Linking>
'Finished building target: Multi-Core-32.out'
' '

**** Build Finished ****

对应的omp.h头文件的88到125行是

extern void omp_set_num_threads (int) __GOMP_NOTHROW;
extern int omp_get_num_threads (void) __GOMP_NOTHROW;
extern int omp_get_max_threads (void) __GOMP_NOTHROW;
extern int omp_get_thread_num (void) __GOMP_NOTHROW;
extern int omp_get_num_procs (void) __GOMP_NOTHROW;

extern int omp_in_parallel (void) __GOMP_NOTHROW;

extern void omp_set_dynamic (int) __GOMP_NOTHROW;
extern int omp_get_dynamic (void) __GOMP_NOTHROW;

extern void omp_set_nested (int) __GOMP_NOTHROW;
extern int omp_get_nested (void) __GOMP_NOTHROW;

extern void omp_init_lock (omp_lock_t *) __GOMP_NOTHROW;
extern void omp_destroy_lock (omp_lock_t *) __GOMP_NOTHROW;
extern void omp_set_lock (omp_lock_t *) __GOMP_NOTHROW;
extern void omp_unset_lock (omp_lock_t *) __GOMP_NOTHROW;
extern int omp_test_lock (omp_lock_t *) __GOMP_NOTHROW;

extern void omp_init_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
extern void omp_destroy_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
extern void omp_set_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
extern void omp_unset_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
extern int omp_test_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;

extern double omp_get_wtime (void) __GOMP_NOTHROW;
extern double omp_get_wtick (void) __GOMP_NOTHROW;

void omp_set_schedule (omp_sched_t, int) __GOMP_NOTHROW;
void omp_get_schedule (omp_sched_t *, int *) __GOMP_NOTHROW;
int omp_get_thread_limit (void) __GOMP_NOTHROW;
void omp_set_max_active_levels (int) __GOMP_NOTHROW;
int omp_get_max_active_levels (void) __GOMP_NOTHROW;
int omp_get_level (void) __GOMP_NOTHROW;
int omp_get_ancestor_thread_num (int) __GOMP_NOTHROW;
int omp_get_team_size (int) __GOMP_NOTHROW;
int omp_get_active_level (void) __GOMP_NOTHROW;

请问哈这个警告时怎么回事呢??

问题二:我用TSCL和TSCH计算程序运行时间,demo如下:

#include <stdio.h>
#include <stdlib.h>
#include <c6x.h>
void test()
{
int a = 0,i;
for (i = 0; i<10000; i++)
a++;
}
int main()
{
printf("starting running\n");
unsigned long long t1,t2;
int i;
TSCL = 0;
TSCH = 0;
t1 = _itoll(TSCH,TSCL);
//#pragma omp parallel for
for (i = 0; i<10000; i++)
test();
t2 = _itoll(TSCH,TSCL);
printf("#cycles == %d\n",(t2-t1));
}

这个demo得到的结果是2100410032,那结果是不是应该除以10^9,为2.1秒呢??这个时间是否准确呢?因为我在PC上用VS跑0.2秒左右,差距很大。跑这个demo的时候基本就这个结果左右,但是我跑我的程序的时候,会出现问题一的警告,结果正常的时候为1559083503,有时候会出现负数的情况,比如出现-1225312956的情况,请问下这个出现负数是怎么回事啊??????