Zoltan is added as thirdParty package

This commit is contained in:
Hamidreza
2025-05-15 21:58:43 +03:30
parent 83a6e4baa1
commit d7479cf1bd
3392 changed files with 318142 additions and 1 deletions

View File

@ -0,0 +1,83 @@
/*
* @HEADER
*
* ***********************************************************************
*
* Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
* Copyright 2012 Sandia Corporation
*
* Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
* the U.S. Government retains certain rights in this software.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Corporation nor the names of the
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Questions? Contact Karen Devine kddevin@sandia.gov
* Erik Boman egboman@sandia.gov
*
* ***********************************************************************
*
* @HEADER
*/
#ifdef __cplusplus
/* if C++, define the rest of this header file as extern C */
extern "C" {
#endif
#include <stddef.h>
#include "zoltan_align.h"
#include "zoltan_util.h"
/*****************************************************************************/
/*
* Routines for properly aligning data.
*/
/*****************************************************************************/
/*
* Plauger alignment algorithm, The Standard C Library.
* Forces malloc'ed variable size struct alignment.
* ZOLTAN_ALIGN_VAL is defined in Zoltan/include/zoltan_align.h;
* values are 0,1,3,7U depending upon machine.
*/
int Zoltan_Align(int a)
{
return((ZOLTAN_ALIGN_VAL + a) & ~ZOLTAN_ALIGN_VAL);
}
size_t Zoltan_Align_size_t(size_t a)
{
return((ZOLTAN_ALIGN_VAL + a) & ~ZOLTAN_ALIGN_VAL);
}
#ifdef __cplusplus
} /* closing bracket for extern "C" */
#endif

View File

@ -0,0 +1,192 @@
/*
* @HEADER
*
* ***********************************************************************
*
* Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
* Copyright 2012 Sandia Corporation
*
* Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
* the U.S. Government retains certain rights in this software.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Corporation nor the names of the
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Questions? Contact Karen Devine kddevin@sandia.gov
* Erik Boman egboman@sandia.gov
*
* ***********************************************************************
*
* @HEADER
*/
#ifdef __cplusplus
/* if C++, define the rest of this header file as extern C */
extern "C" {
#endif
#include <stdio.h>
#include "zoltan_types.h"
#include "zoltan_id.h"
#include "zoltan_util.h"
#include "zoltan_mem.h"
/*****************************************************************************/
/*
* This file contains routines for manipulating
* the global and local IDs used by Zoltan.
*
* Some manipulations are performed via macros. In particular, macros
* specifying whether global or local IDs are to be manipulated are
* provided. Use of these macros is recommended over use of these
* basic functions.
* See zoltan_id.h for definitions of these macros.
*/
/*****************************************************************************/
/*****************************************************************************/
/*
* Routines for allocating and initializing IDs.
*/
ZOLTAN_ID_PTR ZOLTAN_Malloc_ID(int n, char *file, int line)
{
/*
* Allocates an array of size n of ZOLTAN_ID_TYPEs and initializes them.
*/
ZOLTAN_ID_PTR tmp;
char *yo = "ZOLTAN_Malloc_ID";
/*
* Don't use ZOLTAN_MALLOC macro here; prefer to pass file and line
* where ZOLTAN_Malloc_ID was called.
*/
tmp = (ZOLTAN_ID_PTR) Zoltan_Malloc(n * sizeof(ZOLTAN_ID_TYPE), file, line);
if (tmp != NULL) {
ZOLTAN_INIT_ID(n,tmp);
}
else if (n > 0) {
char msg[256];
sprintf(msg, "NULL pointer returned; malloc called from %s, line %d.",
file, line);
ZOLTAN_PRINT_ERROR(-1, yo, msg);
}
return tmp;
}
/*****************************************************************************/
/*****************************************************************************/
/*
* Routines for printing IDs.
*/
void ZOLTAN_PRINT_ID(int n, ZOLTAN_ID_PTR a)
{
/* Prints a single ID. */
int i;
printf("(");
for (i = 0; i < n; i++)
printf( ZOLTAN_ID_SPEC " ",a[i]);
printf(") ");
}
/*****************************************************************************/
/*****************************************************************************/
/*
* Routines to compare Global IDs.
* Functions are provided to test whether two IDs are equal (EQ),
* less than (LT), and greater than (GT).
* The negation operator can be used to test whether two IDs are
* not equal (!ZOLTAN_EQ_ID(n,a,b)), less than or equal (!ZOLTAN_GT_GID(n,a,b))
* or greater than or equal (!ZOLTAN_LT_GID(n,a,b)).
*/
/*****************************************************************************/
int ZOLTAN_EQ_ID(int n, ZOLTAN_ID_PTR a, ZOLTAN_ID_PTR b)
{
/*
* Returns 1 if a == b; 0 otherwise.
* a == b if for all i, a[i] == b[i].
*/
int i;
for (i = 0; i < n; i++)
if (a[i] != b[i])
return(0);
return(1);
}
/*****************************************************************************/
#ifdef ZOLTAN_NEEDED
/* Commented out since never used. */
int ZOLTAN_LT_ID(int n, ZOLTAN_ID_PTR a, ZOLTAN_ID_PTR b)
{
/*
* Returns 1 if a < b; 0 otherwise.
* a < b if for some i, a[i] < b[i] and a[j] == b[j] for all j < i.
*/
int i;
for (i = 0; i < n; i++)
if (a[i] == b[i])
continue;
else if (a[i] > b[i])
return(0);
else /* a[i] < b[i] */
return(1);
return(0); /* because a == b */
}
/*****************************************************************************/
int ZOLTAN_GT_ID(int n, ZOLTAN_ID_PTR a, ZOLTAN_ID_PTR b)
{
/*
* Returns 1 if a < b; 0 otherwise.
* a > b if for some i, a[i] > b[i] and a[j] == b[j] for all j < i.
*/
int i;
for (i = 0; i < n; i++)
if (a[i] == b[i])
continue;
else if (a[i] < b[i])
return(0);
else /* a[i] > b[i] */
return(1);
return(0); /* because a == b */
}
#endif /* ZOLTAN_NEEDED */
#ifdef __cplusplus
} /* closing bracket for extern "C" */
#endif

View File

@ -0,0 +1,109 @@
/*
* @HEADER
*
* ***********************************************************************
*
* Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
* Copyright 2012 Sandia Corporation
*
* Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
* the U.S. Government retains certain rights in this software.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Corporation nor the names of the
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Questions? Contact Karen Devine kddevin@sandia.gov
* Erik Boman egboman@sandia.gov
*
* ***********************************************************************
*
* @HEADER
*/
#ifndef __ZOLTAN_ID_H
#define __ZOLTAN_ID_H
#include "zoltan_types.h"
#ifdef __cplusplus
/* if C++, define the rest of this header file as extern C */
extern "C" {
#endif
/*
* This file contains the data types and comparison functions
* for IDs used by Zoltan and its Utilities. The basic data type
* is ZOLTAN_ID.
*/
/****************************************************************************/
/*
* Default value of ZOLTAN_ID_TYPE;
* IDs allocated with ZOLTAN_MALLOC_ID are initialized with this value.
*/
#define ZOLTAN_ID_DEFAULT 0
/*
* Macros for initializing single IDs.
*/
#define ZOLTAN_INIT_ID(n,id) \
{int ZOLTAN_ID_LOOP; \
for (ZOLTAN_ID_LOOP = 0; ZOLTAN_ID_LOOP < (n); ZOLTAN_ID_LOOP++) \
(id)[ZOLTAN_ID_LOOP] = ZOLTAN_ID_DEFAULT; \
}
/****************************************************************************/
/*
* Macros to copy IDs.
*/
#define ZOLTAN_SET_ID(n,a,b) \
{int ZOLTAN_ID_LOOP; \
for (ZOLTAN_ID_LOOP = 0; ZOLTAN_ID_LOOP < (n); ZOLTAN_ID_LOOP++) \
(a)[ZOLTAN_ID_LOOP] = (b)[ZOLTAN_ID_LOOP]; \
}
/****************************************************************************/
/*
* Prototypes for ID functions in id.c
*/
extern ZOLTAN_ID_PTR ZOLTAN_Malloc_ID(int n, char *file, int line);
extern void ZOLTAN_PRINT_ID(int n, ZOLTAN_ID_PTR a);
extern int ZOLTAN_EQ_ID(int n, ZOLTAN_ID_PTR a, ZOLTAN_ID_PTR b);
#ifdef ZOLTAN_NEEDED
/* Commented out since never used */
extern int ZOLTAN_LT_ID(int n, ZOLTAN_ID_PTR a, ZOLTAN_ID_PTR b);
extern int ZOLTAN_GT_ID(int n, ZOLTAN_ID_PTR a, ZOLTAN_ID_PTR b);
#endif /* ZOLTAN_NEEDED */
#ifdef __cplusplus
} /* closing bracket for extern "C" */
#endif
#endif

View File

@ -0,0 +1,188 @@
/*
* @HEADER
*
* ***********************************************************************
*
* Zoltan Toolkit for Load-balancing, Partitioning, Ordering and Coloring
* Copyright 2012 Sandia Corporation
*
* Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
* the U.S. Government retains certain rights in this software.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the Corporation nor the names of the
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Questions? Contact Karen Devine kddevin@sandia.gov
* Erik Boman egboman@sandia.gov
*
* ***********************************************************************
*
* @HEADER
*/
#ifndef __ZOLTAN_UTIL_H
#define __ZOLTAN_UTIL_H
#ifdef __cplusplus
/* if C++, define the rest of this header file as extern C */
extern "C" {
#endif
/* This block should be executed for Autotools and CMake builds. */
/* The Zoltan classic build defines TRILINOS_NO_CONFIG_H. */
#ifndef TRILINOS_NO_CONFIG_H
#ifdef PACKAGE
#undef PACKAGE
#endif
#ifdef PACKAGE_NAME
#undef PACKAGE_NAME
#endif
#ifdef PACKAGE_BUGREPORT
#undef PACKAGE_BUGREPORT
#endif
#ifdef PACKAGE_STRING
#undef PACKAGE_STRING
#endif
#ifdef PACKAGE_TARNAME
#undef PACKAGE_TARNAME
#endif
#ifdef PACKAGE_VERSION
#undef PACKAGE_VERSION
#endif
#ifdef VERSION
#undef VERSION
#endif
/* This file passes values from configure to the source code. */
#include "Zoltan_config.h"
#ifdef HAVE_PARMETIS
#define ZOLTAN_PARMETIS
#endif
#ifdef HAVE_METIS
#define ZOLTAN_METIS
#endif
#ifdef HAVE_SCOTCH
#define ZOLTAN_SCOTCH
# ifdef HAVE_MPI
# define ZOLTAN_PTSCOTCH
# endif
#endif
#ifdef HAVE_OVIS
#define ZOLTAN_OVIS
#endif
#ifdef HAVE_PATOH
#define ZOLTAN_PATOH
#endif
#ifdef HAVE_CCOLAMD
#define ZOLTAN_CCOLAMD
#endif
#ifdef HAVE_ZOLTAN_HUND
#define ZOLTAN_HUND
#endif
#ifdef HAVE_PARKWAY
#define ZOLTAN_PARKWAY
#endif
#ifdef HAVE_PURIFY
#define ZOLTAN_PURIFY
#define strcmp Zoltan_strcmp
#define strncmp Zoltan_strncmp
#define strcasecmp Zoltan_strcasecmp
#define strncasecmp Zoltan_strncasecmp
#endif
#else /* !AUTOTOOLS_BUILD */
/* With the manual build system we support only Parallel Version of Scotch */
#ifdef ZOLTAN_SCOTCH
#define ZOLTAN_PTSCOTCH
#endif
#endif /* !AUTOTOOLS_BUILD */
/*****************************************************************************/
/*
* Macros and definitions that are common to all Zoltan modules and
* utilities.
*/
/*****************************************************************************/
/*****************************************************************************/
/*
* Macros for consistently printing error and warning messages.
*/
/*****************************************************************************/
void Zoltan_add_back_trace(char *yo);
void Zoltan_remove_back_trace();
void Zoltan_print_trace(int rank);
#define ZOLTAN_PRINT_ERROR(proc,yo,str) { \
fprintf(stderr, "[%d] Zoltan ERROR in %s (line %d of %s): %s\n", \
proc, yo, __LINE__, __FILE__, str); \
Zoltan_print_trace(proc); }
#define ZOLTAN_PRINT_WARN(proc,yo,str) \
fprintf(stderr, "[%d] Zoltan WARNING in %s (line %d of %s): %s\n", \
proc, yo, __LINE__, __FILE__, str);
#define ZOLTAN_TRACE(proc,where,yo,str) \
printf("ZOLTAN (Processor %d) %s %s %s\n", (proc), (where), (yo), \
((str) != NULL ? (char *)(str) : " "));
#define ZOLTAN_TRACE_IN(proc,yo,str) \
ZOLTAN_TRACE((proc),"Entering",(yo),(str));
#define ZOLTAN_TRACE_OUT(proc,yo,str) \
ZOLTAN_TRACE((proc),"Exiting",(yo),(str));
#define ZOLTAN_PRINT_INFO(proc,yo,str) \
printf("ZOLTAN (Processor %d) %s: %s\n", (proc), (yo), \
((str) != NULL ? (char *)(str) : " "));
#ifdef __cplusplus
} /* closing bracket for extern "C" */
#endif
#endif /* !__ZOLTAN_UTIL_H */