include ; #include #include int main(int argc, char** argv) { MPI_Init(&argc, &argv); // Get the number of processes int world_size; MPI_Comm_size(MPI_COMM_WORLD, &world_size); // Get the rank of the process int world_rank; MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); // Get the name of the processor char processor_name[MPI_MAX_PROCESSOR_NAME]; int name_len; MPI_Get_processor_name(processor_name, &name_len); char processor_name_target[MPI_MAX_PROCESSOR_NAME]; int th_id; // Only process 0 can offload to mic if(world_rank==0) { #pragma offload target (mic) #pragma omp parallel private(th_id) { gethostname(processor_name_target,MPI_MAX_PROCESSOR_NAME) ; th_id=omp_get_thread_num(); printf("Hello world from thread %d on processor %s, from mpi process %d\n",th_id,processor_name_target,world_rank); } } // Print off a hello world message printf("Hello world from processor %s, rank %d" " out of %d processors\n", processor_name, world_rank, world_size); // Finalize the MPI environment. MPI_Finalize(); }