[yt-svn] commit/yt: 5 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu May 16 06:25:05 PDT 2013
5 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/2e6d59c25e65/
Changeset: 2e6d59c25e65
Branch: yt
User: ngoldbaum
Date: 2013-05-15 03:35:05
Summary: Checking if the compiler supports openmp, disable openmp if it fails. Closes #567.
This uses a test program from the openmp docs: http://openmp.org/wp/openmp-compilers/
Affected #: 1 file
diff -r 16d8e27e4f93677707b52031eb1cccd3018a7422 -r 2e6d59c25e6551e2d47cd2d157d39763a3bc56d1 yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import setuptools
-import os, sys, os.path, glob
+import os, sys, os.path, glob, \
+ tempfile, subprocess, shutil
def check_for_png():
# First up: HDF5_DIR in environment
@@ -97,11 +98,43 @@
print "You can locate this by looking for the file ft2build.h"
sys.exit(1)
+# see http://openmp.org/wp/openmp-compilers/
+omp_test = r"""#include <omp.h>
+#include <stdio.h>
+int main() {
+#pragma omp parallel
+printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads());
+}
+"""
+
+def check_for_openmp():
+ tmpdir = tempfile.mkdtemp()
+ curdir = os.getcwd()
+ os.chdir(tmpdir)
+
+ filename = r'test.c'
+ file = open(filename,'w', 0)
+ file.write(omp_test)
+ with open(os.devnull, 'w') as fnull:
+ result = subprocess.call(['cc', '-fopenmp', filename], stdout=fnull,
+ stderr=fnull)
+
+ file.close
+ os.chdir(curdir)
+ #clean up
+ shutil.rmtree(tmpdir)
+
+ return result
+
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('lib',parent_package,top_path)
png_inc, png_lib = check_for_png()
freetype_inc, freetype_lib = check_for_freetype()
+ if check_for_openmp() == 0:
+ omp_args = ['-fopenmp']
+ else:
+ omp_args = None
# Because setjmp.h is included by lots of things, and because libpng hasn't
# always properly checked its header files (see
# https://bugzilla.redhat.com/show_bug.cgi?id=494579 ) we simply disable
@@ -129,8 +162,8 @@
depends=["yt/utilities/lib/freetype_includes.h"])
config.add_extension("geometry_utils",
["yt/utilities/lib/geometry_utils.pyx"],
- extra_compile_args=['-fopenmp'],
- extra_link_args=['-fopenmp'],
+ extra_compile_args=omp_args,
+ extra_link_args=omp_args,
libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
config.add_extension("Interpolators",
["yt/utilities/lib/Interpolators.pyx"],
@@ -194,8 +227,8 @@
glob.glob("yt/utilities/lib/healpix_*.c"),
include_dirs=["yt/utilities/lib/"],
libraries=["m"],
- extra_compile_args=['-fopenmp'],
- extra_link_args=['-fopenmp'],
+ extra_compile_args=omp_args,
+ extra_link_args=omp_args,
depends = ["yt/utilities/lib/VolumeIntegrator.pyx",
"yt/utilities/lib/fp_utils.pxd",
"yt/utilities/lib/kdtree.h",
https://bitbucket.org/yt_analysis/yt/commits/dc74830ff8dc/
Changeset: dc74830ff8dc
Branch: yt
User: ngoldbaum
Date: 2013-05-15 04:55:11
Summary: Making check_for_openmp return True if it succeeds and False if it fails.
Affected #: 1 file
diff -r 2e6d59c25e6551e2d47cd2d157d39763a3bc56d1 -r dc74830ff8dcf0b8e1442cf4cce8e1f604fa182f yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -116,7 +116,7 @@
file = open(filename,'w', 0)
file.write(omp_test)
with open(os.devnull, 'w') as fnull:
- result = subprocess.call(['cc', '-fopenmp', filename], stdout=fnull,
+ exit_code = subprocess.call(['cc', '-fopenmp', filename], stdout=fnull,
stderr=fnull)
file.close
@@ -124,14 +124,17 @@
#clean up
shutil.rmtree(tmpdir)
- return result
+ if exit_code == 0:
+ return True
+ else:
+ return False
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('lib',parent_package,top_path)
png_inc, png_lib = check_for_png()
freetype_inc, freetype_lib = check_for_freetype()
- if check_for_openmp() == 0:
+ if check_for_openmp() == True:
omp_args = ['-fopenmp']
else:
omp_args = None
https://bitbucket.org/yt_analysis/yt/commits/b4b33ad63dd7/
Changeset: b4b33ad63dd7
Branch: yt
User: ngoldbaum
Date: 2013-05-15 09:43:16
Summary: Checking for $CC, otherwise using 'cc' as before. Cleaning up.
Thanks Kacper!!
Affected #: 1 file
diff -r dc74830ff8dcf0b8e1442cf4cce8e1f604fa182f -r b4b33ad63dd764cfd3e663459171c116b6849c76 yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -98,30 +98,36 @@
print "You can locate this by looking for the file ft2build.h"
sys.exit(1)
-# see http://openmp.org/wp/openmp-compilers/
-omp_test = r"""#include <omp.h>
-#include <stdio.h>
-int main() {
-#pragma omp parallel
-printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads());
-}
-"""
-
def check_for_openmp():
+ # Create a temporary directory
tmpdir = tempfile.mkdtemp()
curdir = os.getcwd()
os.chdir(tmpdir)
+ # Get compiler invocation
+ compiler = os.getenv("CC")
+ if compiler == None:
+ compiler = 'cc'
+
+ # Attempt to compile a test script.
+ # See http://openmp.org/wp/openmp-compilers/
filename = r'test.c'
file = open(filename,'w', 0)
- file.write(omp_test)
+ file.write(
+ "#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"
+ "}"
+ )
with open(os.devnull, 'w') as fnull:
- exit_code = subprocess.call(['cc', '-fopenmp', filename], stdout=fnull,
- stderr=fnull)
+ exit_code = subprocess.call([compiler, '-fopenmp', filename],
+ stdout=fnull, stderr=fnull)
- file.close
+ # Clean up
+ file.close()
os.chdir(curdir)
- #clean up
shutil.rmtree(tmpdir)
if exit_code == 0:
https://bitbucket.org/yt_analysis/yt/commits/7475fdd08e37/
Changeset: 7475fdd08e37
Branch: yt
User: ngoldbaum
Date: 2013-05-16 03:23:29
Summary: Using os.getenv's second parameter to set the default compiler invocation.
setup.py edited online with Bitbucket
Affected #: 1 file
diff -r b4b33ad63dd764cfd3e663459171c116b6849c76 -r 7475fdd08e371c18415579e0c1dc18d9bdddb18d yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -105,9 +105,7 @@
os.chdir(tmpdir)
# Get compiler invocation
- compiler = os.getenv("CC")
- if compiler == None:
- compiler = 'cc'
+ compiler = os.getenv('CC', 'cc')
# Attempt to compile a test script.
# See http://openmp.org/wp/openmp-compilers/
https://bitbucket.org/yt_analysis/yt/commits/1158e48daef2/
Changeset: 1158e48daef2
Branch: yt
User: MatthewTurk
Date: 2013-05-16 15:24:54
Summary: Merged in ngoldbaum/yt (pull request #500)
Only link against openmp if the compiler supports it.
Affected #: 1 file
diff -r c3dccff32a42e77621d971da15ad0b8a57ccf8eb -r 1158e48daef21366b34aa9f123ae4fd8f1a5bf54 yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import setuptools
-import os, sys, os.path, glob
+import os, sys, os.path, glob, \
+ tempfile, subprocess, shutil
def check_for_png():
# First up: HDF5_DIR in environment
@@ -97,11 +98,50 @@
print "You can locate this by looking for the file ft2build.h"
sys.exit(1)
+def check_for_openmp():
+ # Create a temporary directory
+ tmpdir = tempfile.mkdtemp()
+ curdir = os.getcwd()
+ os.chdir(tmpdir)
+
+ # Get compiler invocation
+ compiler = os.getenv('CC', 'cc')
+
+ # Attempt to compile a test script.
+ # See http://openmp.org/wp/openmp-compilers/
+ filename = r'test.c'
+ file = open(filename,'w', 0)
+ file.write(
+ "#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"
+ "}"
+ )
+ with open(os.devnull, 'w') as fnull:
+ exit_code = subprocess.call([compiler, '-fopenmp', filename],
+ stdout=fnull, stderr=fnull)
+
+ # Clean up
+ file.close()
+ os.chdir(curdir)
+ shutil.rmtree(tmpdir)
+
+ if exit_code == 0:
+ return True
+ else:
+ return False
+
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('lib',parent_package,top_path)
png_inc, png_lib = check_for_png()
freetype_inc, freetype_lib = check_for_freetype()
+ if check_for_openmp() == True:
+ omp_args = ['-fopenmp']
+ else:
+ omp_args = None
# Because setjmp.h is included by lots of things, and because libpng hasn't
# always properly checked its header files (see
# https://bugzilla.redhat.com/show_bug.cgi?id=494579 ) we simply disable
@@ -129,8 +169,8 @@
depends=["yt/utilities/lib/freetype_includes.h"])
config.add_extension("geometry_utils",
["yt/utilities/lib/geometry_utils.pyx"],
- extra_compile_args=['-fopenmp'],
- extra_link_args=['-fopenmp'],
+ extra_compile_args=omp_args,
+ extra_link_args=omp_args,
libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
config.add_extension("Interpolators",
["yt/utilities/lib/Interpolators.pyx"],
@@ -194,8 +234,8 @@
glob.glob("yt/utilities/lib/healpix_*.c"),
include_dirs=["yt/utilities/lib/"],
libraries=["m"],
- extra_compile_args=['-fopenmp'],
- extra_link_args=['-fopenmp'],
+ extra_compile_args=omp_args,
+ extra_link_args=omp_args,
depends = ["yt/utilities/lib/VolumeIntegrator.pyx",
"yt/utilities/lib/fp_utils.pxd",
"yt/utilities/lib/kdtree.h",
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list