[CIG-SEISMO] scotch and clock_gettime

Dimitri Komatitsch komatitsch at lma.cnrs-mrs.fr
Fri Oct 17 13:56:32 PDT 2014


Dear François, dear all,

As a patch could I just comment this statement out in the source code of 
SCOTCH? i.e., is that timing routine really crucial or is it used to 
print execution times for information only? (if so, when called from 
SPECFEM we could just ignore the timing information, which we do not use).

Thanks,
Best regards,

Dimitri.

On 10/17/2014 10:41 PM, Dimitri Komatitsch wrote:
>
> Dear Eve, dear all,
>
> This is a known problem that comes from SCOTCH and is unrelated to
> SPECFEM. I mentioned it to François Pellegrini, the author of SCOTCH, a
> couple of years ago. Basically SCOTCH (at least version 5.1) does not
> compile on MAC OS because of that call to clock_gettime().
>
> We mention a trick in the users manual somewhere:
>
> \item [Mac OS] You will probably need to install \texttt{XCODE}.
> In addition, the \texttt{clock\_gettime} routine, which is used by the
> \texttt{SCOTCH} library that we use, does not exist in Mac OS.
> You may need to replace it with \texttt{clock\_get\_time} if you want to
> use \texttt{SCOTCH}.
>
>
> (just make that change in the SCOTCH source file and you should be all
> set).
>
> François, did you fix that in SCOTCH version 6?
>
> I think that Brad also fixed it in a different way, but probably in the
> 3D version of SPECFEM only (?).
>
> Thanks,
> Dimitri.
>
> On 10/17/2014 01:28 PM, Eve Tsang-Hin-Sun wrote:
>> Dear all,
>>
>> I am trying ti compile SPECFEM2D. It worked well on my ubuntu laptop but
>> fails on my iMac 10.8.5. As I understoof from prvious discussion, th
>> problem come from incompatibility with librt and mac OS.
>>
>> Before changing any thing here is the error I got when  trying te make
>> command into the src directory of scotch :
>>
>> 1ldo162:SPECFEM2D_Eve tsanghin$ make
>> mkdir -p obj
>> mkdir -p bin
>> (cd src/meshfem2D; make )
>> (echo "Using bundled Scotch")
>> Using bundled Scotch
>> (cd "scotch_5.1.12b/src"; make)
>> (cd libscotch ;      make VERSION=5 RELEASE=1 PATCHLEVEL=12 scotch &&
>> make install)
>> rm -f *~ *.o lib*.a parser_yy.c parser_ly.h parser_ll.c *scotch.h
>> *scotchf.h y.output dummysizes
>> make CC="gcc" CCD="gcc"\
>> scotch.h\
>> scotchf.h\
>> libscotch.a\
>> libscotcherr.a\
>> libscotcherrexit.a
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict -DSCOTCH_VERSION=5
>> -DSCOTCH_RELEASE=1 -DSCOTCH_PATCHLEVEL=12 dummysizes.c -o dummysizes -lz
>> -lm -lrt -lpthread
>> ld: library not found for -lrt
>> clang: error: linker command failed with exit code 1 (use -v to see
>> invocation)
>> make[4]: *** [dummysizes] Error 1
>> make[3]: *** [scotch] Error 2
>> make[2]: *** [scotch] Error 2
>> make[1]: *** [scotch] Error 2
>> make: *** [xmeshfem2D] Error 2
>>
>>
>> Then, according to the user manual, the clock_gettime routine, that
>> calls librt has to be changed to clock_get_time in the common.c script.
>> So I did it and also removed -lrt from the Makefil.inc file. Then after
>> the new make, here is what I get :
>>
>>
>>
>> 1ldo162:src tsanghin$ make
>> (cd libscotch ;      make VERSION=5 RELEASE=1 PATCHLEVEL=12 scotch &&
>> make install)
>> rm -f *~ *.o lib*.a parser_yy.c parser_ly.h parser_ll.c *scotch.h
>> *scotchf.h y.output dummysizes
>> make CC="gcc" CCD="gcc"\
>> scotch.h\
>> scotchf.h\
>> libscotch.a\
>> libscotcherr.a\
>> libscotcherrexit.a
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict -DSCOTCH_VERSION=5
>> -DSCOTCH_RELEASE=1 -DSCOTCH_PATCHLEVEL=12 dummysizes.c -o dummysizes -lz
>> -lm -lpthread
>> ./dummysizes library.h scotch.h
>> ./dummysizes libraryf.h scotchf.h
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch.c -o arch.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_build.c -o arch_build.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_cmplt.c -o arch_cmplt.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_cmpltw.c -o arch_cmpltw.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_deco.c -o arch_deco.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_hcub.c -o arch_hcub.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_mesh.c -o arch_mesh.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_tleaf.c -o arch_tleaf.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_torus.c -o arch_torus.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_vcmplt.c -o arch_vcmplt.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c arch_vhcub.c -o arch_vhcub.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph.c -o bgraph.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_bipart_bd.c -o
>> bgraph_bipart_bd.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_bipart_df.c -o
>> bgraph_bipart_df.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_bipart_ex.c -o
>> bgraph_bipart_ex.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_bipart_fm.c -o
>> bgraph_bipart_fm.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_bipart_gg.c -o
>> bgraph_bipart_gg.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_bipart_gp.c -o
>> bgraph_bipart_gp.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_bipart_ml.c -o
>> bgraph_bipart_ml.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_bipart_st.c -o
>> bgraph_bipart_st.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_bipart_zr.c -o
>> bgraph_bipart_zr.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_check.c -o
>> bgraph_check.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c bgraph_store.c -o
>> bgraph_store.o
>> gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_PTHREAD
>> -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -DSCOTCH_RENAME_PARSER
>> -DSCOTCH_PTHREAD -Drestrict=__restrict  -c common.c
>> -DSCOTCH_COMMON_RENAME -o common.o
>> common.c:107:3: warning: implicit declaration of function
>> 'clock_get_time' is invalid in C99 [-Wimplicit-function-declaration]
>>    clock_get_time (CLOCK_REALTIME, &tp);            /* Elapsed time */
>>    ^
>> common.c:107:19: error: use of undeclared identifier 'CLOCK_REALTIME'
>>    clock_get_time (CLOCK_REALTIME, &tp);            /* Elapsed time */
>>                    ^
>> 1 warning and 1 error generated.
>> make[2]: *** [common.o] Error 1
>> make[1]: *** [scotch] Error 2
>> make: *** [scotch] Error 2
>>
>>
>> So I am a little bit confused : it seems that the clock_get_time routine
>> is not defined. So where should I get it ?  Moreover, if the librt
>> library doesn’t exist for mac OS, isn’t it another way to get the time
>> step ? Or maybe the Makefile.Inc is ot well configured for mac ? If you
>> have any tips to make it compile, that would be very helpful.
>> Regards
>>
>> --
>> Eve Tsang-Hin-Sun
>> Doctorante
>> Institut Universitaire Européen de la Mer (IUEM)
>> Laboratoires Domaines Océaniques (LDO)
>> Place Nicolas Copernic - 29280 Plouzané
>>
>>
>>
>> _______________________________________________
>> CIG-SEISMO mailing list
>> CIG-SEISMO at geodynamics.org
>> http://lists.geodynamics.org/cgi-bin/mailman/listinfo/cig-seismo
>>
>

-- 
Dimitri Komatitsch
CNRS Research Director (DR CNRS), Laboratory of Mechanics and Acoustics,
UPR 7051, Marseille, France    http://komatitsch.free.fr


More information about the CIG-SEISMO mailing list