/* ! ============================================================================ ! Print number of processors found and value of OMP_NUM_THREADS (max_threads) ! Say hello from tid, using %3.3d format for easy sorting ! ! icc -xCORE-AVX512 -O3 -qopenmp omp_hello.c -o omp_hello ! ./omp_hello | sort ! ============================================================================ */ #include #include int main(){ int tid; tid = omp_get_thread_num(); printf(" 0> Hello from Xeon SP\n"); printf(" 0> Value of omp_get_num_procs(): %3d\n", omp_get_num_procs()); printf(" 0> Value of omp_get_max_threads(): %3d\n", omp_get_max_threads()); #pragma omp parallel private(tid) { tid = omp_get_thread_num(); printf(" => hello from thread id %3.3d\n", tid); } printf(" x> goodbye from thread id %3.3d\n", tid); }