def check_for_openmp():
 tmpdir = tempfile.mkdtemp()
 curdir = os.getcwd()
 exit_code = 1
 if (os.name == 'nt'):
  return False
 try:
  os.chdir(tmpdir)
  compiler = os.getenv('CC', 'cc')
  filename = 'test.c'
  source = open(filename, 'wt', 1)
  source.write('\n            #include <omp.h>\n            #include <stdio.h>\n            int main() {\n            #pragma omp parallel\n            printf("Hello from thread %d, nthreads %d",\n                    omp_get_thread_num(), omp_get_num_threads());\n            }\n            ')
  with open(os.devnull, 'w') as fnull:
   exit_code = subprocess.call([compiler, '-fopenmp', filename], stdout=fnull, stderr=fnull)
  source.close()
 finally:
  os.chdir(curdir)
  shutil.rmtree(tmpdir)
 return (exit_code == 0)

def check_for_openmp ( ) : tmpdir = tempfile . mkdtemp ( ) curdir = os . getcwd ( ) exit_code = 1 if ( os . name == 'nt' ) : return False try : os . chdir ( tmpdir ) compiler = os . getenv ( 'CC' , 'cc' ) filename = 'test.c' source = open ( filename , 'wt' , 1 ) source . write ( '\n            #include <omp.h>\n            #include <stdio.h>\n            int main() {\n            #pragma omp parallel\n            printf("Hello from thread %d, nthreads %d",\n                    omp_get_thread_num(), omp_get_num_threads());\n            }\n            ' ) with open ( os . devnull , 'w' ) as fnull : exit_code = subprocess . call ( [ compiler , '-fopenmp' , filename ] , stdout = fnull , stderr = fnull ) source . close ( ) finally : os . chdir ( curdir ) shutil . rmtree ( tmpdir ) return ( exit_code == 0 )
check for openmp support .