Redefinition error when compiling the parallel cases

336 views
Skip to first unread message

Zhou Zhang

unread,
Jul 19, 2020, 1:06:28 PM7/19/20
to basilisk-fr
Hello everyone,

I am trying to compile a parallel run on a supercomputer, following the instructions on http://basilisk.fr/src/Tips. I used

qcc -source -D_MPI=1 -grid=multigrid 2Dirregular.c
mpicc
-Wall -std=c99 -O2 -D_MPI=1 _2Dirregular.c -o 2Dirregular -lm

Then I got the following error messages:

/home/joezhang/basilisk/src/utils.h:8:8: error: redefinition of ‘DT’
 double DT = 1e10, CFL = 0.5;
        ^
/home/joezhang/basilisk/src/utils.h:8:8: note: previous definition of ‘DT’ was here
 double DT = 1e10, CFL = 0.5;
        ^
/home/joezhang/basilisk/src/utils.h:8:19: error: redefinition of ‘CFL’
 double DT = 1e10, CFL = 0.5;
                   ^
/home/joezhang/basilisk/src/utils.h:8:19: note: previous definition of ‘CFL’ was here
 double DT = 1e10, CFL = 0.5;
                   ^
/home/joezhang/basilisk/src/utils.h:24:3: error: conflicting types for ‘perf’
 } perf;
   ^
/home/joezhang/basilisk/src/utils.h:24:3: note: previous declaration of ‘perf’ was here
 } perf;
   ^
/home/joezhang/basilisk/src/utils.h:30:6: error: redefinition of ‘update_perf’
 void update_perf() {
      ^
/home/joezhang/basilisk/src/utils.h:30:6: note: previous definition of ‘update_perf’ was here
 void update_perf() {
      ^
/home/joezhang/basilisk/src/utils.h:51:3: error: conflicting types for ‘timing’
 } timing;
   ^
/home/joezhang/basilisk/src/utils.h:51:3: note: previous declaration of ‘timing’ was here
 } timing;
   ^
/home/joezhang/basilisk/src/utils.h:58:8: error: conflicting types for ‘timer_timing’
 timing timer_timing (timer t, int i, size_t tnc, double * mpi)
        ^
/home/joezhang/basilisk/src/utils.h:58:8: note: previous definition of ‘timer_timing’ was here
 timing timer_timing (timer t, int i, size_t tnc, double * mpi)
        ^
/home/joezhang/basilisk/src/utils.h:104:6: error: redefinition of ‘timer_print’
 void timer_print (timer t, int i, size_t tnc)
      ^
/home/joezhang/basilisk/src/utils.h:104:6: note: previous definition of ‘timer_print’ was here
 void timer_print (timer t, int i, size_t tnc)
      ^
/home/joezhang/basilisk/src/utils.h:130:3: error: conflicting types for ‘norm’
 } norm;
   ^
/home/joezhang/basilisk/src/utils.h:130:3: note: previous declaration of ‘norm’ was here
 } norm;
   ^
/home/joezhang/basilisk/src/utils.h:132:6: error: conflicting types for ‘normf’
 norm normf (scalar f)
      ^
/home/joezhang/basilisk/src/utils.h:132:6: note: previous definition of ‘normf’ was here
 norm normf (scalar f)
      ^
/home/joezhang/basilisk/src/utils.h:158:3: error: conflicting types for ‘stats’
 } stats;
   ^
/home/joezhang/basilisk/src/utils.h:158:3: note: previous declaration of ‘stats’ was here
 } stats;
   ^
/home/joezhang/basilisk/src/utils.h:160:7: error: conflicting types for ‘statsf’
 stats statsf (scalar f)
       ^
/home/joezhang/basilisk/src/utils.h:160:7: note: previous definition of ‘statsf’ was here
 stats statsf (scalar f)
       ^
/home/joezhang/basilisk/src/utils.h:187:15: error: redefinition of ‘generic_limiter’
 static double generic_limiter (double r, double beta)
               ^
/home/joezhang/basilisk/src/utils.h:187:15: note: previous definition of ‘generic_limiter’ was here
 static double generic_limiter (double r, double beta)
               ^
/home/joezhang/basilisk/src/utils.h:194:8: error: redefinition of ‘minmod’
 double minmod (double s0, double s1, double s2) {
        ^
/home/joezhang/basilisk/src/utils.h:194:8: note: previous definition of ‘minmod’ was here
 double minmod (double s0, double s1, double s2) {
        ^
/home/joezhang/basilisk/src/utils.h:198:8: error: redefinition of ‘superbee’
 double superbee (double s0, double s1, double s2) {
        ^
/home/joezhang/basilisk/src/utils.h:198:8: note: previous definition of ‘superbee’ was here
 double superbee (double s0, double s1, double s2) {
        ^
/home/joezhang/basilisk/src/utils.h:202:8: error: redefinition of ‘sweby’
 double sweby (double s0, double s1, double s2) {
        ^
/home/joezhang/basilisk/src/utils.h:202:8: note: previous definition of ‘sweby’ was here
 double sweby (double s0, double s1, double s2) {
        ^
/home/joezhang/basilisk/src/utils.h:213:8: error: redefinition of ‘theta’
 double theta = 1.3;
        ^
/home/joezhang/basilisk/src/utils.h:213:8: note: previous definition of ‘theta’ was here
 double theta = 1.3;
        ^
/home/joezhang/basilisk/src/utils.h:215:8: error: redefinition of ‘minmod2’
 double minmod2 (double s0, double s1, double s2)
        ^
/home/joezhang/basilisk/src/utils.h:215:8: note: previous definition of ‘minmod2’ was here
 double minmod2 (double s0, double s1, double s2)
        ^
/home/joezhang/basilisk/src/utils.h:237:6: error: redefinition of ‘gradients’
 void gradients (scalar * f, vector * g)
      ^
/home/joezhang/basilisk/src/utils.h:237:6: note: previous definition of ‘gradients’ was here
 void gradients (scalar * f, vector * g)
      ^
/home/joezhang/basilisk/src/utils.h:275:6: error: redefinition of ‘vorticity’
 void vorticity (const vector u, scalar omega)
      ^
/home/joezhang/basilisk/src/utils.h:275:6: note: previous definition of ‘vorticity’ was here
 void vorticity (const vector u, scalar omega)
      ^
/home/joezhang/basilisk/src/utils.h:290:8: error: redefinition of ‘change’
 double change (scalar s, scalar sn)
        ^
/home/joezhang/basilisk/src/utils.h:290:8: note: previous definition of ‘change’ was here
 double change (scalar s, scalar sn)
        ^
/home/joezhang/basilisk/src/utils.h:308:8: error: redefinition of ‘lookup_field’
 scalar lookup_field (const char * name)
        ^
/home/joezhang/basilisk/src/utils.h:308:8: note: previous definition of ‘lookup_field’ was here
 scalar lookup_field (const char * name)
        ^
/home/joezhang/basilisk/src/utils.h:317:8: error: redefinition of ‘lookup_vector’
 vector lookup_vector (const char * name)
        ^
/home/joezhang/basilisk/src/utils.h:317:8: note: previous definition of ‘lookup_vector’ was here
 vector lookup_vector (const char * name)
        ^
/home/joezhang/basilisk/src/output.h:37:8: error: redefinition of ‘struct OutputField’
 struct OutputField {
        ^
/home/joezhang/basilisk/src/output.h:37:8: note: originally defined here
 struct OutputField {
        ^
/home/joezhang/basilisk/src/output.h:46:6: error: conflicting types for ‘output_field’
 void output_field (struct OutputField p)
      ^
/home/joezhang/basilisk/src/output.h:46:6: note: previous definition of ‘output_field’ was here
 void output_field (struct OutputField p)
      ^
/home/joezhang/basilisk/src/output.h:140:8: error: redefinition of ‘struct OutputMatrix’
 struct OutputMatrix {
        ^
/home/joezhang/basilisk/src/output.h:140:8: note: originally defined here
 struct OutputMatrix {
        ^
/home/joezhang/basilisk/src/output.h:148:6: error: conflicting types for ‘output_matrix’
 void output_matrix (struct OutputMatrix p)
      ^
/home/joezhang/basilisk/src/output.h:148:6: note: previous definition of ‘output_matrix’ was here
 void output_matrix (struct OutputMatrix p)
      ^
/home/joezhang/basilisk/src/output.h:186:6: error: redefinition of ‘jet’
 void jet (double cmap[NCMAP][3])
      ^
/home/joezhang/basilisk/src/output.h:186:6: note: previous definition of ‘jet’ was here
 void jet (double cmap[NCMAP][3])
      ^
/home/joezhang/basilisk/src/output.h:207:6: error: redefinition of ‘cool_warm’
 void cool_warm (double cmap[NCMAP][3])
      ^
/home/joezhang/basilisk/src/output.h:207:6: note: previous definition of ‘cool_warm’ was here
 void cool_warm (double cmap[NCMAP][3])
      ^
/home/joezhang/basilisk/src/output.h:259:6: error: redefinition of ‘gray’
 void gray (double cmap[NCMAP][3])
      ^
/home/joezhang/basilisk/src/output.h:259:6: note: previous definition of ‘gray’ was here
 void gray (double cmap[NCMAP][3])
      ^
/home/joezhang/basilisk/src/output.h:266:6: error: redefinition of ‘randomap’
 void randomap (double cmap[NCMAP][3])
      ^
/home/joezhang/basilisk/src/output.h:266:6: note: previous definition of ‘randomap’ was here
 void randomap (double cmap[NCMAP][3])
      ^
/home/joezhang/basilisk/src/output.h:280:3: error: conflicting types for ‘color’
 } color;
   ^
/home/joezhang/basilisk/src/output.h:280:3: note: previous declaration of ‘color’ was here
 } color;
   ^
/home/joezhang/basilisk/src/output.h:282:7: error: conflicting types for ‘colormap_color’
 color colormap_color (double cmap[NCMAP][3],
       ^
/home/joezhang/basilisk/src/output.h:282:7: note: previous definition of ‘colormap_color’ was here
 color colormap_color (double cmap[NCMAP][3],
       ^
/home/joezhang/basilisk/src/output.h:321:21: error: redefinition of ‘extension’
 static const char * extension (const char * file, const char * ext) {
                     ^
/home/joezhang/basilisk/src/output.h:321:21: note: previous definition of ‘extension’ was here
 static const char * extension (const char * file, const char * ext) {
                     ^
/home/joezhang/basilisk/src/output.h:326:21: error: redefinition of ‘is_animation’
 static const char * is_animation (const char * file) {
                     ^
/home/joezhang/basilisk/src/output.h:326:21: note: previous definition of ‘is_animation’ was here
 static const char * is_animation (const char * file) {
                     ^
/home/joezhang/basilisk/src/output.h:339:3: error: conflicting types for ‘open_image_data’
 } open_image_data = {NULL, NULL, 0};
   ^
/home/joezhang/basilisk/src/output.h:339:3: note: previous definition of ‘open_image_data’ was here
 } open_image_data = {NULL, NULL, 0};
   ^
/home/joezhang/basilisk/src/output.h:341:13: error: redefinition of ‘open_image_cleanup’
 static void open_image_cleanup()
             ^
/home/joezhang/basilisk/src/output.h:341:13: note: previous definition of ‘open_image_cleanup’ was here
 static void open_image_cleanup()
             ^
/home/joezhang/basilisk/src/output.h:354:15: error: redefinition of ‘open_image_lookup’
 static FILE * open_image_lookup (const char * file)
               ^
/home/joezhang/basilisk/src/output.h:354:15: note: previous definition of ‘open_image_lookup’ was here
 static FILE * open_image_lookup (const char * file)
               ^
/home/joezhang/basilisk/src/output.h:362:13: error: redefinition of ‘which’
 static bool which (const char * command)
             ^
/home/joezhang/basilisk/src/output.h:362:13: note: previous definition of ‘which’ was here
 static bool which (const char * command)
             ^
/home/joezhang/basilisk/src/output.h:385:15: error: redefinition of ‘ppm_fallback’
 static FILE * ppm_fallback (const char * file, const char * mode)
               ^
/home/joezhang/basilisk/src/output.h:385:15: note: previous definition of ‘ppm_fallback’ was here
 static FILE * ppm_fallback (const char * file, const char * mode)
               ^
/home/joezhang/basilisk/src/output.h:401:8: error: redefinition of ‘open_image’
 FILE * open_image (const char * file, const char * options)
        ^
/home/joezhang/basilisk/src/output.h:401:8: note: previous definition of ‘open_image’ was here
 FILE * open_image (const char * file, const char * options)
        ^
/home/joezhang/basilisk/src/output.h:475:6: error: redefinition of ‘close_image’
 void close_image (const char * file, FILE * fp)
      ^
/home/joezhang/basilisk/src/output.h:475:6: note: previous definition of ‘close_image’ was here
 void close_image (const char * file, FILE * fp)
      ^
/home/joezhang/basilisk/src/output.h:552:8: error: redefinition of ‘struct OutputPPM’
 struct OutputPPM {
        ^
/home/joezhang/basilisk/src/output.h:552:8: note: originally defined here
 struct OutputPPM {
        ^
/home/joezhang/basilisk/src/output.h:566:6: error: conflicting types for ‘output_ppm’
 void output_ppm (struct OutputPPM p)
      ^
/home/joezhang/basilisk/src/output.h:566:6: note: previous definition of ‘output_ppm’ was here
 void output_ppm (struct OutputPPM p)
      ^
/home/joezhang/basilisk/src/output.h:684:8: error: redefinition of ‘struct OutputGRD’
 struct OutputGRD {
        ^
/home/joezhang/basilisk/src/output.h:684:8: note: originally defined here
 struct OutputGRD {
        ^
/home/joezhang/basilisk/src/output.h:694:6: error: conflicting types for ‘output_grd’
 void output_grd (struct OutputGRD p)
      ^
/home/joezhang/basilisk/src/output.h:694:6: note: previous definition of ‘output_grd’ was here
 void output_grd (struct OutputGRD p)
      ^
/home/joezhang/basilisk/src/output.h:780:8: error: redefinition of ‘struct OutputGfs’
 struct OutputGfs {
        ^
/home/joezhang/basilisk/src/output.h:780:8: note: originally defined here
 struct OutputGfs {
        ^
/home/joezhang/basilisk/src/output.h:788:15: error: redefinition of ‘replace’
 static char * replace (const char * input, int target, int with,
               ^
/home/joezhang/basilisk/src/output.h:788:15: note: previous definition of ‘replace’ was here
 static char * replace (const char * input, int target, int with,
               ^
/home/joezhang/basilisk/src/output.h:809:6: error: conflicting types for ‘output_gfs’
 void output_gfs (struct OutputGfs p)
      ^
/home/joezhang/basilisk/src/output.h:809:6: note: previous definition of ‘output_gfs’ was here
 void output_gfs (struct OutputGfs p)
      ^
/home/joezhang/basilisk/src/output.h:1010:8: error: redefinition of ‘struct Dump’
 struct Dump {
        ^
/home/joezhang/basilisk/src/output.h:1010:8: note: originally defined here
 struct Dump {
        ^
/home/joezhang/basilisk/src/output.h:1017:8: error: redefinition of ‘struct DumpHeader’
 struct DumpHeader {
        ^
/home/joezhang/basilisk/src/output.h:1017:8: note: originally defined here
 struct DumpHeader {
        ^
/home/joezhang/basilisk/src/output.h:1024:18: error: redefinition of ‘dump_version’
 static const int dump_version =
                  ^
/home/joezhang/basilisk/src/output.h:1024:18: note: previous definition of ‘dump_version’ was here
 static const int dump_version =
                  ^
/home/joezhang/basilisk/src/output.h:1028:17: error: redefinition of ‘dump_list’
 static scalar * dump_list (scalar * lista)
                 ^
/home/joezhang/basilisk/src/output.h:1028:17: note: previous definition of ‘dump_list’ was here
 static scalar * dump_list (scalar * lista)
                 ^
/home/joezhang/basilisk/src/output.h:1037:13: error: conflicting types for ‘dump_header’
 static void dump_header (FILE * fp, struct DumpHeader * header, scalar * list)
             ^
/home/joezhang/basilisk/src/output.h:1037:13: note: previous definition of ‘dump_header’ was here
 static void dump_header (FILE * fp, struct DumpHeader * header, scalar * list)
             ^
/home/joezhang/basilisk/src/output.h:1118:6: error: conflicting types for ‘dump’
   char def[] = "dump", * file = p.file ? p.file : p.fp ? NULL : def;
      ^
/home/joezhang/basilisk/src/output.h:1118:6: note: previous definition of ‘dump’ was here
   char def[] = "dump", * file = p.file ? p.file : p.fp ? NULL : def;
      ^
/home/joezhang/basilisk/src/output.h:1190:6: error: conflicting types for ‘restore’
 bool restore (struct Dump p)
      ^
/home/joezhang/basilisk/src/output.h:1190:6: note: previous definition of ‘restore’ was here
 bool restore (struct Dump p)
      ^


I'm really confused about it because the 'redefinitions' seem the same as the 'previous definitions'. Does anyone have such a problem before? Any suggestions will be appreciated.

Thanks,
Zhou

Bradley Boyd

unread,
Aug 5, 2021, 2:51:45 PM8/5/21
to basilisk-fr
Hello Zhou Zhang

Did you ever figure out the issue?

Kind regards

Bradley

Zhou Zhang

unread,
Aug 13, 2021, 4:47:39 PM8/13/21
to basilisk-fr
Hi Bradley,

Sorry for the late reply. It seemed that my problem was that I have defined some environmental variables, which changed the paths to the libraries so that some variables might have been defined multiple times. After I remove those environmental variables, my codes compiled smoothly. Hope this helps!

Zhou
Reply all
Reply to author
Forward
0 new messages