[MITgcm-devel] testreport and cross compiling
Martin Losch
Martin.Losch at awi.de
Tue Feb 12 04:47:08 EST 2008
To follow up on this: I have replace in genmake2 all lines (there
were 3)
make genmake_tc_1.o >> genmake_warnings 2>&1
with
COMM="$CC $CFLAGS -c genmake_tc_1.c"
echo $COMM >> genmake_warnings
$COMM >> genmake_warnings 2>&1
in anology to the fortran command. With this change, my problems on
the SX8 are solved, both for genmake and for testreport.
If there is no particular reason for using the make-command for
compiling the c-test-codes, I would like to check in this change to
genmake2. May I?
Martin
On 12 Feb 2008, at 09:25, Martin Losch wrote:
> Hi Ed,
> can you help me with this? As you know, this is the code that tests
> "Can we call simple C routines (here, "cloc()") using sxmpif90 ...":
>> check_HAVE_CLOC() {
>> get_fortran_c_namemangling
>> cat <<EOF > genmake_tc_1.c
>> $FC_NAMEMANGLE
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <unistd.h>
>> #include <assert.h>
>> #include <sys/time.h>
>> void FC_NAMEMANGLE(cloc) ( double *curtim )
>> {
>> struct timeval tv1;
>> gettimeofday(&tv1 , (void *)NULL );
>> *curtim = (double)((tv1.tv_usec)+(tv1.tv_sec)*1.E6);
>> *curtim = *curtim/1.E6;
>> }
>> EOF
>> make genmake_tc_1.o >> genmake_warnings 2>&1
>> RET_C=$?
>> cat <<EOF > genmake_tc_2.$FS
>> program hello
>> REAL*8 wtime
>> external cloc
>> call cloc(wtime)
>> print *," HELLO WORLD", wtime
>> end
>> EOF
>> COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
>> echo $COMM >> genmake_warnings
>> $COMM >> genmake_warnings 2>&1
>> RET_F=$?
>> test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1
>> RETVAL=$?
>> if test "x$RETVAL" = x0 ; then
>> HAVE_CLOC=t
>> DEFINES="$DEFINES -DHAVE_CLOC"
>> fi
>> rm -f genmake_tc*
>> }
>
> This is how the c-code is compiled:
> make genmake_tc_1.o >> genmake_warnings 2>&1
> this is how the fortran code is compiled:
> COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
> echo $COMM >> genmake_warnings
> $COMM >> genmake_warnings 2>&1
>
> why don't you use something like $CC -c genmake_tc_1.f >>
> genmake_warnings 2>&1 for the C-code. Is "make" supposed to know
> about the value of CC?
>
> This is what happens (frequently) on the SX8: on prestine directory
> I run genmake2 and the script hangs during this test (actually
> during the link step), with Ctrl-C I can interrupt this test, the
> script continues with a lot of failures (because cc is used instead
> of CC='sxcc -sx8r'), and a Makefile is generated. Now I can either
> repeat the genmake command or run "make makefile" and this second
> time around genmake uses the correct compilers etc. Really strange,
> but true. I am attaching the genmake_warning-files from these two
> rounds and you see that in the second case the sxcc compiler is used.
>
> But, wouldn't it be more robust not to use make but rather some
> form similar to the fortran command line to compile the c-code?
>
> Martin
>
>
>
> <genmake_warnings.1.gz><genmake_warnings.2.gz>
>
>
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-devel
More information about the MITgcm-devel
mailing list