Commit 97f81f08 authored by Yan Bao's avatar Yan Bao

update of movingbody branch is completed

parent 015addee

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

This diff is collapsed.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# compile in Release mode by default
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
PROJECT(GSMPI)
# First check to see if our compiler has MPI built in to avoid linking libraries etc.
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckFunctionExists)
CHECK_INCLUDE_FILES (mpi.h HAVE_MPI_H)
CHECK_FUNCTION_EXISTS(MPI_Send HAVE_MPI_SEND)
IF (NOT "${HAVE_MPI_H}" OR NOT "${HAVE_MPI_SEND}")
INCLUDE(FindMPI)
INCLUDE_DIRECTORIES( ${MPI_INCLUDE_PATH} )
ENDIF ()
ADD_DEFINITIONS(-DMPI -DPREFIX=nektar_ -DNO_NEK_EXITT -DGLOBAL_LONG)
ADD_DEFINITIONS(-DPRINT_MALLOCS=0 -DUSE_NAIVE_BLAS)
SET(GS_SOURCES
src/gs.c
src/sort.c
src/sarray_transfer.c
src/sarray_sort.c
src/gs_local.c
src/fail.c
src/crystal.c
src/comm.c
src/tensor.c
)
SET(GS_HEADERS
src/gs.h
)
SET(XXT_SOURCES
src/xxt.c
src/sparse_cholesky.c
)
SET(XXT_HEADERS
src/sparse_cholesky.c
)
ADD_LIBRARY(gsmpi STATIC ${GS_SOURCES})
ADD_LIBRARY(xxt STATIC ${XXT_SOURCES})
IF (NOT "${HAVE_MPI_H}" OR NOT "${HAVE_MPI_SEND}")
TARGET_LINK_LIBRARIES(gsmpi ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
TARGET_LINK_LIBRARIES(xxt ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
SET_PROPERTY(TARGET gsmpi APPEND PROPERTY LINK_FLAGS
${MPI_LINK_FLAGS})
SET_PROPERTY(TARGET xxt APPEND PROPERTY LINK_FLAGS
${MPI_LINK_FLAGS})
ENDIF ()
SET_PROPERTY(TARGET gsmpi APPEND PROPERTY COMPILE_FLAGS
"-fPIC -W -Wall -Wno-unused-function -Wno-unused-parameter ${MPI_COMPILE_FLAGS}")
SET_PROPERTY(TARGET xxt APPEND PROPERTY COMPILE_FLAGS
"-fPIC -W -Wall -Wno-unused-function -Wno-unused-parameter ${MPI_COMPILE_FLAGS}")
INSTALL(TARGETS gsmpi DESTINATION lib)
INSTALL(TARGETS xxt DESTINATION lib)
NEK5000: Spectral Element Computational Fluid Dynamics Solver
COPYRIGHT (c) 2008,2009,2010 UCHICAGO ARGONNE, LLC
The UChicago Argonne, LLC as Operator of Argonne National
Laboratory holds copyright in the Software. The copyright holder
reserves all rights except those expressly granted to licensees,
and U.S. Government license rights.
License
NEK5000 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
NEK5000 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with NEK5000. If not, see <http://www.gnu.org/licenses/>.
GS-MPI
------
SVN ver: 987
Date: 2013-11-22 20:48:11
These libraries encapsulate the gather-scatter exchange routines and parallel
direct solver from Nek5000 (http://nek5000.mcs.anl.gov/). This software is
distributed under the GNU General Public License, in accordance with Nek5000.
See the attached LICENSE file for details.
The routines were primarily written by James Lottes.
#ifndef C99_H
#define C99_H
#ifndef __STDC_VERSION__
# define NO_C99
#elif __STDC_VERSION__ < 199901L
# define NO_C99
#endif
#ifdef NO_C99
# define restrict
# define inline
# undef NO_C99
#endif
#endif
#include <stddef.h> /* for size_t */
#include <stdlib.h> /* for exit */
#include <string.h> /* memcpy */
#include <limits.h> /* for gs identities */
#include <float.h> /* for gs identities */
#include "name.h"
#include "fail.h"
#include "types.h"
#include "tensor.h"
#include "gs_defs.h"
#include "gs_local.h"
#include "comm.h"
uint comm_gbl_id=0, comm_gbl_np=1;
GS_DEFINE_IDENTITIES()
GS_DEFINE_DOM_SIZES()
static void scan_imp(void *scan, const struct comm *com, gs_dom dom, gs_op op,
const void *v, uint vn, void *buffer)
{
comm_req req[2];
size_t vsize = vn*gs_dom_size[dom];
const uint id=com->id, np=com->np;
uint n = np, c=1, odd=0, base=0;
void *buf[2];
void *red = (char*)scan+vsize;
buf[0]=buffer,buf[1]=(char*)buffer+vsize;
while(n>1) {
odd=(odd<<1)|(n&1);
c<<=1, n>>=1;
if(id>=base+n) c|=1, base+=n, n+=(odd&1);
}
gs_init_array(scan,vn,dom,op);
memcpy(red,v,vsize);
while(n<np) {
if(c&1) n-=(odd&1), base-=n;
c>>=1, n<<=1, n+=(odd&1);
odd>>=1;
if(base==id) {
comm_irecv(&req[0],com, buf[0],vsize, id+n/2,id+n/2);
comm_isend(&req[1],com, red ,vsize, id+n/2,id);
comm_wait(req,2);
gs_gather_array(red,buf[0],vn,dom,op);
} else {
comm_irecv(&req[0],com, scan,vsize, base,base);
comm_isend(&req[1],com, red ,vsize, base,id);
comm_wait(req,2);
break;
}
}
while(n>1) {
if(base==id) {
comm_send(com, scan ,2*vsize, id+n/2,id);
} else {
comm_recv(com, buffer,2*vsize, base,base);
gs_gather_array(scan,buf[0],vn,dom,op);
memcpy(red,buf[1],vsize);
}
odd=(odd<<1)|(n&1);
c<<=1, n>>=1;
if(id>=base+n) c|=1, base+=n, n+=(odd&1);
}
}
static void allreduce_imp(const struct comm *com, gs_dom dom, gs_op op,
void *v, uint vn, void *buf)
{
size_t total_size = vn*gs_dom_size[dom];
const uint id=com->id, np=com->np;
uint n = np, c=1, odd=0, base=0;
while(n>1) {
odd=(odd<<1)|(n&1);
c<<=1, n>>=1;
if(id>=base+n) c|=1, base+=n, n+=(odd&1);
}
while(n<np) {
if(c&1) n-=(odd&1), base-=n;
c>>=1, n<<=1, n+=(odd&1);
odd>>=1;
if(base==id) {
comm_recv(com, buf,total_size, id+n/2,id+n/2);
gs_gather_array(v,buf,vn, dom,op);
} else {
comm_send(com, v,total_size, base,id);
break;
}
}
while(n>1) {
if(base==id)
comm_send(com, v,total_size, id+n/2,id);
else