- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm quite new to fortran programming. I'm currently working on a new project involving a simulation code written in Fortran which compiles and runs fine using ifort 11.1. My task is to add a new module which has been coded in C++ for several reasons I can't get through here.
The situation can be summarized has follows: an F1 fortran routine calls a C1 c++ function. This calling seems to work fine. C1 calls a F2 fortran routine to perform many calculations (all coded in fortran). The F2 exeution is then buggy and the program exit for an input/output error, namely
forrtl: No such file or directory
forrtl: severe (29): file not found, unit 11, file /home/andrea/svn/gol/projects/mac-geo/src/iTOUGH2/Samples/sample3/fort.11
unit 11 is indeed in use and opened on a file called itough2.ver. regular output has been performed before the error happens.
Using the valgrind memory checker signals no illegal operations but many uninitialized values used in i/o operations.
The C++ code declares the fortran routine as:
#ifdef __cplusplus
extern"C" {
#endif
extern void fcnlev_(const long int* mm, const long int* nn, const double* xp, const double* fvec);
#ifdef __cplusplus
}
#endif
the fcnlev_ function is declared on the fortran side as
SUBROUTINE FCNLEV(MM,NN,XP,F)
IMPLICIT NONE
INTEGER MM,NN
REAL*8 F,XP
DIMENSION XP(NN),F(MM)
I'm using ifort and icc in a 64bit linux environemnt. Compiling and linking options are the following:
ifort options: -fpp -pc80 -ip -mkl=sequential -rcd -shared-intel -lowercase -g
icc options: -g -fPIC
Any Ideas?
Thanks,
Andrea
I'm quite new to fortran programming. I'm currently working on a new project involving a simulation code written in Fortran which compiles and runs fine using ifort 11.1. My task is to add a new module which has been coded in C++ for several reasons I can't get through here.
The situation can be summarized has follows: an F1 fortran routine calls a C1 c++ function. This calling seems to work fine. C1 calls a F2 fortran routine to perform many calculations (all coded in fortran). The F2 exeution is then buggy and the program exit for an input/output error, namely
forrtl: No such file or directory
forrtl: severe (29): file not found, unit 11, file /home/andrea/svn/gol/projects/mac-geo/src/iTOUGH2/Samples/sample3/fort.11
unit 11 is indeed in use and opened on a file called itough2.ver. regular output has been performed before the error happens.
Using the valgrind memory checker signals no illegal operations but many uninitialized values used in i/o operations.
The C++ code declares the fortran routine as:
#ifdef __cplusplus
extern"C" {
#endif
extern void fcnlev_(const long int* mm, const long int* nn, const double* xp, const double* fvec);
#ifdef __cplusplus
}
#endif
the fcnlev_ function is declared on the fortran side as
SUBROUTINE FCNLEV(MM,NN,XP,F)
IMPLICIT NONE
INTEGER MM,NN
REAL*8 F,XP
DIMENSION XP(NN),F(MM)
I'm using ifort and icc in a 64bit linux environemnt. Compiling and linking options are the following:
ifort options: -fpp -pc80 -ip -mkl=sequential -rcd -shared-intel -lowercase -g
icc options: -g -fPIC
Any Ideas?
Thanks,
Andrea
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
long is a 64-bit data type in 64-bit mode, which doesn't match Fortran default integer. USE iso_c_binding would help make the interface more portable, avoiding the need for -lowercase.
-rcd, if it does anything, is dangerous, it may change the rounding behavior entirely between -g (implying -O0) and an optimized build.
I take it your -mkl is pseudo-code; I don't see how it can work as written.
-rcd, if it does anything, is dangerous, it may change the rounding behavior entirely between -g (implying -O0) and an optimized build.
I take it your -mkl is pseudo-code; I don't see how it can work as written.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
long is a 64-bit data type in 64-bit mode, which doesn't match Fortran default integer. USE iso_c_binding would help make the interface more portable, avoiding the need for -lowercase.
-rcd, if it does anything, is dangerous, it may change the rounding behavior entirely between -g (implying -O0) and an optimized build.
I take it your -mkl is pseudo-code; I don't see how it can work as written.
-rcd, if it does anything, is dangerous, it may change the rounding behavior entirely between -g (implying -O0) and an optimized build.
I take it your -mkl is pseudo-code; I don't see how it can work as written.
Thank you tim18,
I've revised the options I was using but things are still messy! I dropped the -rcdand checked for the -mkl too, but my problem still persists. I tried to use iso_c_binding but, at least in a very simple form, I got no sucess. Indeed, I should try not to modified the fortran code, or at least only what is strict necessary. I tried to add
-integer-size 64 and -O0
to the ifort options to get integer be of the same size and avoid optimizations, but still things do not work.
Andrea

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page