[f2py] Re: f2py-users Digest, Vol 55, Issue 2
Shang-Jun Ye <[email protected]>
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Johanna, Thanks for your kindly reply. I have specified the number of the character string, however, segmentation fault still occurs. Could anyone help me fix it? Here is my files: ! output.f95 subroutine output implicit none write(*,'(A2)') 'Hi' end subroutine output after executing f2py, everything went smoothly, until run it by the following command Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import output >>> output.output() Segmentation fault ~$ f2py -c --fcompiler=gnu95 -m output output.f95 running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src building extension "output" sources f2py options: [] f2py:> /tmp/tmpflxkgj/src.linux-i686-2.6/outputmodule.c creating /tmp/tmpflxkgj creating /tmp/tmpflxkgj/src.linux-i686-2.6 Reading fortran codes... Reading file 'output.f95' (format:free) Post-processing... Block: output Block: output Post-processing (stage 2)... Building modules... Building module "output"... Constructing wrapper function "output"... output() Wrote C/API module "output" to file "/tmp/tmpflxkgj/src.linux-i686-2.6/outputmodule.c" adding '/tmp/tmpflxkgj/src.linux-i686-2.6/fortranobject.c' to sources. adding '/tmp/tmpflxkgj/src.linux-i686-2.6' to include_dirs. copying /usr/lib/python2.6/dist-packages/numpy/f2py/src/fortranobject.c -> /tmp/tmpflxkgj/src.linux-i686-2.6 copying /usr/lib/python2.6/dist-packages/numpy/f2py/src/fortranobject.h -> /tmp/tmpflxkgj/src.linux-i686-2.6 running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext customize Gnu95FCompiler Found executable /usr/bin/gfortran customize Gnu95FCompiler using build_ext building 'output' extension compiling C sources C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC creating /tmp/tmpflxkgj/tmp creating /tmp/tmpflxkgj/tmp/tmpflxkgj creating /tmp/tmpflxkgj/tmp/tmpflxkgj/src.linux-i686-2.6 compile options: '-I/tmp/tmpflxkgj/src.linux-i686-2.6 -I/usr/lib/python2.6/dist-packages/numpy/core/include -I/usr/include/python2.6 -c' gcc: /tmp/tmpflxkgj/src.linux-i686-2.6/outputmodule.c gcc: /tmp/tmpflxkgj/src.linux-i686-2.6/fortranobject.c compiling Fortran sources Fortran f77 compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -fPIC -O3 -funroll-loops -march=nocona -mmmx -msse2 -msse -msse3 -fomit-frame-pointer -malign-double Fortran f90 compiler: /usr/bin/gfortran -Wall -fno-second-underscore -fPIC -O3 -funroll-loops -march=nocona -mmmx -msse2 -msse -msse3 -fomit-frame-pointer -malign-double Fortran fix compiler: /usr/bin/gfortran -Wall -ffixed-form -fno-second-underscore -Wall -fno-second-underscore -fPIC -O3 -funroll-loops -march=nocona -mmmx -msse2 -msse -msse3 -fomit-frame-pointer -malign-double compile options: '-I/tmp/tmpflxkgj/src.linux-i686-2.6 -I/usr/lib/python2.6/dist-packages/numpy/core/include -I/usr/include/python2.6 -c' gfortran:f90: output.f95 /usr/bin/gfortran -Wall -Wall -shared /tmp/tmpflxkgj/tmp/tmpflxkgj/src.linux-i686-2.6/outputmodule.o /tmp/tmpflxkgj/tmp/tmpflxkgj/src.linux-i686-2.6/fortranobject.o /tmp/tmpflxkgj/output.o -lgfortran -o ./output.so running scons Removing build directory /tmp/tmpflxkgj 2009/9/17 <f2py-users-request-Y4l6ocDipWCuvFJfX82//[email protected]>: > Send f2py-users mailing list submissions to > f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://cens.ioc.ee/mailman/listinfo/f2py-users > or, via email, send a message with subject or body 'help' to > f2py-users-request-Y4l6ocDipWCuvFJfX82//[email protected] > > You can reach the person managing the list at > f2py-users-owner-Y4l6ocDipWCuvFJfX82//[email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of f2py-users digest..." > > > Today's Topics: > > 1. Segmentation fault for format write (Shang-Jun Ye) > 2. RE: Segmentation fault for format write (Torppa Johanna) > 3. control number of OpenMP threads at runtime (Steve Schmerler) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Wed, 16 Sep 2009 11:51:57 +0100 > From: Shang-Jun Ye <[email protected]> > Subject: [f2py] Segmentation fault for format write > To: f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > Message-ID: > <a0f7437b0909160351p22e25dcdncbce361367f786e8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > I try to integrate a Fortran output subroutine by Python, the f2py > runs successfully, however, when I run the script, I have got a > Segmentation fault without any more infomation. does f2py support > format write? > here is my Fortran subroutine : > ! output.f95 > subroutine output > implicit none > write(*,'(1x,a)') 'write something' > !write(*,*)'write something' !works well > > end subroutine output > > the corresponding python script is > import output > output.output() > ! >>>Segmentation fault > > > > ------------------------------ > > Message: 2 > Date: Wed, 16 Sep 2009 14:28:23 +0300 > From: Torppa Johanna <[email protected]> > Subject: RE: [f2py] Segmentation fault for format write > To: For users of the f2py program <f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]> > Message-ID: > <CDC71670B5C4D842B22F4C56819D4D8CB8EC3E27C1-YItVQVvtHi9tTTueRX380nsDi8qcUmLV0e7PPNI6Mm0@public.gmane.org> > > Content-Type: text/plain; charset="us-ascii" > > > Formatted output with the 'write' command should work. With both strings and numbers. Try to define the number of string digits, e.g., A20. > > bw, Johanna Torppa > > -----Original Message----- > From: f2py-users-bounces-Y4l6ocDipWCuvFJfX82//[email protected] [mailto: f2py-users-bounces-Y4l6ocDipWCuvFJfX82//[email protected]] On Behalf Of Shang-Jun Ye > Sent: 16. syyskuuta 2009 13:52 > To: f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > Subject: [f2py] Segmentation fault for format write > > Hi, > I try to integrate a Fortran output subroutine by Python, the f2py > runs successfully, however, when I run the script, I have got a > Segmentation fault without any more infomation. does f2py support > format write? > here is my Fortran subroutine : > ! output.f95 > subroutine output > implicit none > write(*,'(1x,a)') 'write something' > !write(*,*)'write something' !works well > > end subroutine output > > the corresponding python script is > import output > output.output() > ! >>>Segmentation fault > > _______________________________________________ > f2py-users mailing list > f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > http://cens.ioc.ee/mailman/listinfo/f2py-users > > > > ------------------------------ > > Message: 3 > Date: Thu, 17 Sep 2009 10:13:10 +0200 > From: Steve Schmerler <[email protected]> > Subject: [f2py] control number of OpenMP threads at runtime > To: f2py-users <f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]> > Message-ID: <20090917081310.GA3701-uj/[email protected]> > Content-Type: text/plain; charset=us-ascii > > Hi > > I use OpenMP to speed up subroutines in my extension modules. I don't > set the number of threads in the code (e.g. with !$omp parallel > num_threads(N) or omp_set_num_threads(N)). > > Without these the code runs 4 threads on a quad-core box. The problem > is: the extension module does not seem to honor the OMP_NUM_THREADS > environment var (it does for a "normal" Fortran executable). How do I > control the number of threads at runtime for the extension module? > > best, > Steve > > > > ------------------------------ > > _______________________________________________ > f2py-users mailing list > f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > http://cens.ioc.ee/mailman/listinfo/f2py-users > > > End of f2py-users Digest, Vol 55, Issue 2 > ***************************************** > _______________________________________________ f2py-users mailing list f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] http://cens.ioc.ee/mailman/listinfo/f2py-users