/* * @@name: target_data.3c * @@type: C * @@compilable: yes * @@linkable: no * @@expect: success */ #include void gramSchmidt(restrict float Q[][COLS], const int rows, const int cols) { #pragma omp target data map(Q[0:rows][0:cols]) for(int k=0; k < cols; k++) { double tmp = 0.0; #pragma omp target #pragma omp parallel for reduction(+:tmp) for(int i=0; i < rows; i++) tmp += (Q[i][k] * Q[i][k]); tmp = 1/sqrt(tmp); #pragma omp target #pragma omp parallel for for(int i=0; i < rows; i++) Q[i][k] *= tmp; } }