/* * @@name: host_teams.1 * @@type: C * @@operation: run * @@expect: success * @@version: omp_5.0 */ #include #include #include #include #define N 1000 int main(){ int nteams_required=2, max_thrds, tm_id; float sp_x[N], sp_y[N], sp_a=0.0001e0; double dp_x[N], dp_y[N], dp_a=0.0001e0; max_thrds = omp_get_num_procs()/nteams_required; // Create 2 teams, each team works in a different precision #pragma omp teams num_teams(nteams_required) \ thread_limit(max_thrds) private(tm_id) { tm_id = omp_get_team_num(); if( omp_get_num_teams() != 2 ) //if only getting 1, quit { printf("error: Insufficient teams on host, 2 required\n"); exit(0); } if(tm_id == 0) // Do Single Precision Work (SAXPY) with this team { #pragma omp parallel { #pragma omp for //init for(int i=0; i