Fenix @develop
 
Loading...
Searching...
No Matches
fenix_util.hpp
1/*
2//@HEADER
3// ************************************************************************
4//
5//
6// _|_|_|_| _|_|_|_| _| _| _|_|_| _| _|
7// _| _| _|_| _| _| _| _|
8// _|_|_| _|_|_| _| _| _| _| _|
9// _| _| _| _|_| _| _| _|
10// _| _|_|_|_| _| _| _|_|_| _| _|
11//
12//
13//
14//
15// Copyright (C) 2016 Rutgers University and Sandia Corporation
16//
17// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18// the U.S. Government retains certain rights in this software.
19//
20// Redistribution and use in source and binary forms, with or without
21// modification, are permitted provided that the following conditions are
22// met:
23//
24// 1. Redistributions of source code must retain the above copyright
25// notice, this list of conditions and the following disclaimer.
26//
27// 2. Redistributions in binary form must reproduce the above copyright
28// notice, this list of conditions and the following disclaimer in the
29// documentation and/or other materials provided with the distribution.
30//
31// 3. Neither the name of the Corporation nor the names of the
32// contributors may be used to endorse or promote products derived from
33// this software without specific prior written permission.
34//
35// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
36// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
39// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
40// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
41// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
42// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
43// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
44// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
45// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46//
47// Author Marc Gamell, Eric Valenzuela, Keita Teranishi, Manish Parashar
48// Michael Heroux, and Matthew Whitlock
49//
50// Questions? Contact Keita Teranishi (knteran@sandia.gov) and
51// Marc Gamell (mgamell@cac.rutgers.edu)
52//
53// ************************************************************************
54//@HEADER
55*/
56
57#ifndef __FENIX_UTIL__
58#define __FENIX_UTIL__
59
60#include "fenix_process_recovery.hpp"
61#include <mpi.h>
62#include <syslog.h>
63#include <sys/types.h>
64#include <sys/times.h>
65#include <unistd.h>
66#include <stdlib.h>
67#include <stdio.h>
68#include <string.h>
69#include <errno.h>
70#include <sys/stat.h>
71#include <stdarg.h>
72#include <fcntl.h>
73#include <dirent.h>
74#include <sys/time.h>
75#include <signal.h>
76#include <libgen.h>
77
78extern char *logname;
79
80#define LDEBUG(f...) {LLIND("debug",f);}
81#define LLIND(t,f...) {fprintf(stderr,"%s - %s (%i): %s: \n",logname,__PRETTY_FUNCTION__,getpid(),t); fprintf(stderr,f);}
82#define ERRHANDLE(f...){LFATAL(f);}
83#define LFATAL(f...) {LLINF("fatal", f);}
84#define LLINF(t,f...) {fprintf(stderr,"(%i): %s: ", getpid(), t); fprintf(stderr, f);}
85
86enum states { EMPTY = 0, OCCUPIED = 1, DELETED = 2, NEEDFIX = 3 };
87
88void __fenix_ranks_agree(int *, int *, int *, MPI_Datatype *);
89
90int __fenix_binary_search(int *, int, int);
91
92int __fenix_comparator(const void *, const void *);
93
94int __fenix_get_size(MPI_Datatype);
95
96int __fenix_get_fenix_default_rank_separation();
97
98int __fenix_get_current_rank(MPI_Comm);
99
100int __fenix_get_partner_rank(int, MPI_Comm);
101
102int __fenix_get_world_size(MPI_Comm);
103
104int __fenix_mpi_wait(MPI_Request *);
105
106int __fenix_mpi_test(MPI_Request *);
107
108
109
110void *s_calloc(int count, size_t size);
111
112void *s_malloc(size_t size);
113
114void *s_realloc(void *mem, size_t size);
115
116#endif