SIONlib  1.6.2
Scalable I/O library for parallel access to task-local files
sion_omp_internal_gen.c
Go to the documentation of this file.
1 /****************************************************************************
2 ** SIONLIB http://www.fz-juelich.de/jsc/sionlib **
3 *****************************************************************************
4 ** Copyright (c) 2008-2016 **
5 ** Forschungszentrum Juelich, Juelich Supercomputing Centre **
6 ** **
7 ** See the file COPYRIGHT in the package base directory for details **
8 ****************************************************************************/
9 
14 #include <stdlib.h>
15 #include <stdio.h>
16 #include <stdarg.h>
17 #include <string.h>
18 #include <time.h>
19 
20 #if defined(_BGL)
21 #include <rts.h>
22 #ifndef __USE_FILE_OFFSET64
23 #define __USE_FILE_OFFSET64
24 #endif
25 #endif
26 
27 #include <sys/time.h>
28 
29 #include <sys/types.h>
30 #include <fcntl.h>
31 
32 #include <unistd.h>
33 
34 #include "sion.h"
35 #include "sion_debug.h"
36 #include "sion_internal.h"
37 #include "sion_fd.h"
38 #include "sion_filedesc.h"
39 #include "sion_printts.h"
40 
41 #include "sion_omp_internal_gen.h"
42 
43 #ifdef SION_OMP
44 
45 #include "omp.h"
46 
47 int _sion_errorprint_omp(int rc, int level, const char *format, ...)
48 {
49  int rank=-1;
50  va_list ap;
51  int rankselect=-1;
52  const char *t;
53 
54 
55  rank = omp_get_thread_num();
56 
57 
58  t = _sion_getenv("SION_ERROR_MSG_RANK");
59  if (t) rankselect = atoi(t);
60 
61  switch (level) {
62  case _SION_ERROR_RETURN:
63  if((rankselect<0) || (rankselect==rank)) {
64  fprintf(stderr,"SION_ERROR_RETURN on rank %d, rc=%d: ",rank,rc);
65  va_start(ap, format);
66  vfprintf(stderr, format, ap);
67  va_end(ap);
68  fprintf(stderr,"\n");
69  }
70  return (rc);
71  break;
72  case _SION_ERROR_ABORT:
73  if((rankselect<0) || (rankselect==rank)) {
74  fprintf(stderr,"SION_ERROR_ABORT on rank %d, rc=%d: ",rank,rc);
75  va_start(ap, format);
76  vfprintf(stderr, format, ap);
77  va_end(ap);
78  fprintf(stderr,"\n");
79  }
80  exit (rc);
81  break;
82  default:
83  if((rankselect<0) || (rankselect==rank)) {
84 
85  fprintf(stderr,"SION_ERROR_UNKNOWN on rank %d, rc=%d: ",rank,rc);
86  va_start(ap, format);
87  vfprintf(stderr, format, ap);
88  va_end(ap);
89  fprintf(stderr,"\n");
90  }
91  return (rc);
92  }
93  return (rc);
94 }
95 
96 /* end of ifdef OMP */
97 #endif
char * _sion_getenv(const char *name)
Sion Time Stamp Header.