Posted to tcl by patthoyts at Fri Mar 16 13:55:19 GMT 2007view raw

  1. #define _CRT_SECURE_NO_DEPRECATE
  2.  
  3. #include <omp.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. int
  8. main(int argc, char *const argv[])
  9. {
  10. if (argc > 1) {
  11. long nThreads = strtol(argv[1], NULL, 0);
  12. omp_set_num_threads(nThreads);
  13. }
  14.  
  15. #pragma omp parallel
  16. {
  17. printf("thread id %d\n", omp_get_thread_num());
  18. }
  19. return 0;
  20. }