Commit 8590e7ac authored by Nathanael Schaeffer @home's avatar Nathanael Schaeffer @home
Browse files

setup.py is created by ./configure with correct options. OpenMP enabled by default for python.

parent ef0fe12c
......@@ -25,6 +25,13 @@ FEATURES:
- accurate up to spherical harmonic degree l=8000 (at least).
- rotation functions to rotate spherical harmonics (beta).
INSTALL:
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. `./configure --help' will list
available options. However, in order to get the best performance, it is highly
recommended to compile and install the FFTW library yourself, because many
distribution include a non-optimized FFTW library.
DOCUMENTATION:
......@@ -37,7 +44,7 @@ DOCUMENTATION:
CHANGE LOG:
tip:
v2.2.1 (21 May 2012)
- slightly faster parallel transforms.
- better Python interface: decent error handling and keyword argument support.
- changes to Python interface: grid defaults to SHT_PHI_CONTIGUOUS, set_grid_auto() removed.
......
......@@ -2180,6 +2180,8 @@ fi
# Check whether --enable-openmp was given.
if test "${enable_openmp+set}" = set; then :
enableval=$enable_openmp;
else
enable_openmp=default
fi
# Check whether --enable-python was given.
......@@ -2205,10 +2207,15 @@ if test "${enable_simd+set}" = set; then :
fi
if test "$prefix" = "NONE"; then :
prefix=$ac_default_prefix
fi
# Checks for programs.
if test "x$CFLAGS" = "x"; then
CFLAGS="-O2"
fi
CFLAGS="$CFLAGS -I$prefix/include -L$prefix/lib"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
......@@ -3725,6 +3732,13 @@ done
# Checks related to OpenMP
if test "x$enable_python" != "xno"; then :
if test "x$enable_openmp" = "xdefault"; then :
enable_openmp=yes
fi
fi
if test "x$enable_openmp" = "xyes"; then :
......@@ -4150,9 +4164,10 @@ rm -f core conftest.err conftest.$ac_objext \
$as_echo "$rtc_ok" >&6; }
### end cycle.h ###
echo "prefix=$prefix"
ac_config_files="$ac_config_files Makefile"
ac_config_files="$ac_config_files Makefile setup.py"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
......@@ -4846,6 +4861,7 @@ do
case $ac_config_target in
"sht_config.h") CONFIG_HEADERS="$CONFIG_HEADERS sht_config.h" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"setup.py") CONFIG_FILES="$CONFIG_FILES setup.py" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
......
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_PREREQ([2.59])
AC_INIT([SHTns],[2.2],[],[shtns],[https://bitbucket.org/nschaeff/shtns])
AC_CONFIG_SRCDIR([SHT.c])
AC_CONFIG_HEADERS([sht_config.h])
......@@ -15,7 +15,7 @@ AC_ARG_ENABLE([verbose],
AS_HELP_STRING([--enable-verbose=0-3], [define verbosity level for the library: 0=silent, 1=default, 2=debug, 3=full]),
[],[enable_verbose=1])
AC_ARG_ENABLE([openmp],
AS_HELP_STRING([--enable-openmp], [Enable multi-threading with OpenMP]))
AS_HELP_STRING([--enable-openmp], [Enable multi-threading with OpenMP]), [], [enable_openmp=default])
AC_ARG_ENABLE([python],
AS_HELP_STRING([--enable-python], [Build Python interface]),
[], [enable_python=no])
......@@ -26,10 +26,16 @@ AC_ARG_ENABLE([f77],
AC_ARG_ENABLE([simd],
AS_HELP_STRING([--disable-simd], [Do not use SSE2 or AVX extensions]))
dnl Sanitize $prefix. Autoconf does this by itself, but so late in the
dnl generated configure script that the expansion does not occur until
dnl after our eval magic below.
AS_IF([test "$prefix" = "NONE"],[prefix=$ac_default_prefix])
# Checks for programs.
if test "x$CFLAGS" = "x"; then
CFLAGS="-O2"
fi
CFLAGS="$CFLAGS -I$prefix/include -L$prefix/lib"
AC_PROG_CC
AC_PROG_SED
if test "$SED" = :; then
......@@ -66,6 +72,9 @@ AC_CHECK_LIB([fftw3],[fftw_plan_many_dft],,AC_MSG_ERROR([FFTW3 library required.
AC_CHECK_HEADERS([stdlib.h stdio.h string.h math.h complex.h fftw3.h])
# Checks related to OpenMP
AS_IF([test "x$enable_python" != "xno"], [
AS_IF([test "x$enable_openmp" = "xdefault"], [enable_openmp=yes])
])
AS_IF([test "x$enable_openmp" = "xyes"], [
AC_OPENMP
AC_CHECK_LIB([fftw3_omp], [fftw_init_threads])
......@@ -152,7 +161,8 @@ AC_CHECK_FUNCS([fftw_cost])
AC_MSG_RESULT($rtc_ok)
### end cycle.h ###
echo "prefix=$prefix"
AC_SUBST([target])
AC_SUBST([install])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Makefile setup.py])
AC_OUTPUT
......@@ -513,7 +513,7 @@ SHTns provides a Python interface that uses <a href="http://numpy.scipy.org/">Nu
The Python interface has been generated using <a href="http://www.swig.org/">SWIG</a> (but you don't need it to compile the the Python package).
\li Compile using
\code ./configure --enable-openmp --enable-python
\code ./configure --enable-python
make \endcode
Optionally you can give indicate an alternate pyhton interpreter to \c ./configure using PYTHON=<my-python> (see ./configure --help)
......
......@@ -5,11 +5,17 @@ from numpy import get_include
numpy_inc = get_include() # NumPy include path.
shtns_o = ['SHT.o', 'sht_std.o', 'sht_ltr.o', 'sht_m0.o', 'sht_m0ltr.o']
libdir = "@prefix@/lib"
cargs = "@OPENMP_CFLAGS@"
libs = "@LIBS@"
libslist = libs.replace('-l','').split() # transform to list of libraries
shtns_module = Extension('_shtns', sources=['shtns_numpy_wrap.c'],
extra_objects=shtns_o, depends=shtns_o,
include_dirs=[numpy_inc],
libraries=['fftw3', 'fftw3_omp'])
extra_compile_args=[cargs],
library_dirs=[libdir],
libraries=libslist,
include_dirs=[numpy_inc])
setup(name='SHTns',
version='2.2',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment