By default __transaction is assumed to be an __transaction[[atomic]] You can only have transaction_safe calls inside these regions. To call a transcation_callable function use __transaction [[relaxed]] { ... bar()...}
transaction_callable not recognized by compiler
如需更全面地了解编译器优化,请参阅优化注意事项.



transaction_callable not recognized by compiler
I'm using the STM 4.0 compiler with a new Ubuntu 10.10 installation.
But the compiler doesn't recognize some of the transaction constructs. For example, transaction_safe works fine, transaction_callable creates an error.
Here is some sample code:
#include #include #include [[transaction_safe]] int foo(int a){ return ++a; } //__attribute__((tm_callable)) [[transaction_callable]] void bar(){ // do nothing } int main(){ int i; #pragma omp parallel for for(i=0;i<10;i++){ int val = i; //__tm_atomic{ __transaction{ val = foo(val); bar(); } printf("%dn", val); } }The Error Message is:
icc -Qtm_enabled -openmp foo.c -o foo
foo.c(24) (col. 6): error: non transaction ready function "bar" called inside __transaction section
foo.c(18): (col. 5) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.
compilation aborted for foo.c (code 2)
I've checked the compiler. It is the Prototype Edition 4.0.
I would appreciate any suggestions.
Thank you in advance.
mer