forked from moebiusband/NuSiF-Solver
		
	Remaining update
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
# Supported: GCC, CLANG, ICC
 | 
			
		||||
TAG ?= ICC
 | 
			
		||||
# Supported: GCC, CLANG, ICX
 | 
			
		||||
TAG ?= ICX
 | 
			
		||||
# Supported: true, false
 | 
			
		||||
ENABLE_MPI ?= true
 | 
			
		||||
ENABLE_OPENMP ?= false
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
ifeq ($(ENABLE_MPI),true)
 | 
			
		||||
CC   = mpiicc
 | 
			
		||||
CC   = mpiicx
 | 
			
		||||
DEFINES  = -D_MPI
 | 
			
		||||
else
 | 
			
		||||
CC = icc
 | 
			
		||||
CC = icx
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
GCC  = gcc
 | 
			
		||||
@@ -13,7 +13,7 @@ OPENMP   = -qopenmp
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
VERSION  = --version
 | 
			
		||||
CFLAGS   =  -O3 -xHost -qopt-zmm-usage=high -std=c99 $(OPENMP)
 | 
			
		||||
CFLAGS   =  -O3 -xHost -qopt-zmm-usage=high -std=c99 $(OPENMP) -Wno-unused-command-line-argument
 | 
			
		||||
LFLAGS   = $(OPENMP)
 | 
			
		||||
DEFINES  += -D_GNU_SOURCE# -DDEBUG
 | 
			
		||||
INCLUDES =
 | 
			
		||||
@@ -9,17 +9,6 @@
 | 
			
		||||
#include "comm.h"
 | 
			
		||||
 | 
			
		||||
#ifdef _MPI
 | 
			
		||||
// subroutines local to this module
 | 
			
		||||
static int sum(int* sizes, int position)
 | 
			
		||||
{
 | 
			
		||||
    int sum = 0;
 | 
			
		||||
 | 
			
		||||
    for (int i = 0; i < position; i += position) {
 | 
			
		||||
        sum += sizes[i];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return sum;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void gatherArray(
 | 
			
		||||
    Comm* c, int cnt, int* rcvCounts, int* displs, double* src, double* dst)
 | 
			
		||||
@@ -133,8 +122,8 @@ void commCollectResult(Comm* c,
 | 
			
		||||
    double* u,
 | 
			
		||||
    double* v,
 | 
			
		||||
    double* p,
 | 
			
		||||
    int jmax,
 | 
			
		||||
    int imax)
 | 
			
		||||
    int imax,
 | 
			
		||||
    int jmax)
 | 
			
		||||
{
 | 
			
		||||
#ifdef _MPI
 | 
			
		||||
    int *rcvCounts, *displs;
 | 
			
		||||
 
 | 
			
		||||
@@ -17,6 +17,25 @@
 | 
			
		||||
#include "progress.h"
 | 
			
		||||
#include "timing.h"
 | 
			
		||||
 | 
			
		||||
static FILE* initResidualWriter()
 | 
			
		||||
{
 | 
			
		||||
    FILE* fp;
 | 
			
		||||
    fp = fopen("residual.dat", "w");
 | 
			
		||||
 | 
			
		||||
    if (fp == NULL) {
 | 
			
		||||
        printf("Error!\n");
 | 
			
		||||
        exit(-1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return fp;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void writeResidual(FILE* fp, double ts, double res)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(fp, "%f, %f\n", ts, res);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void writeResults(Discretization* s)
 | 
			
		||||
{
 | 
			
		||||
#ifdef _MPI
 | 
			
		||||
 
 | 
			
		||||
@@ -48,23 +48,4 @@ void stopProgress()
 | 
			
		||||
{
 | 
			
		||||
    printf("\n");
 | 
			
		||||
    fflush(stdout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FILE* initResidualWriter()
 | 
			
		||||
{
 | 
			
		||||
    FILE* fp;
 | 
			
		||||
    fp = fopen("residual.dat", "w");
 | 
			
		||||
 | 
			
		||||
    if (fp == NULL) {
 | 
			
		||||
        printf("Error!\n");
 | 
			
		||||
        exit(-1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return fp;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void writeResidual(FILE* fp, double ts, double res)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(fp, "%f, %f\n", ts, res);
 | 
			
		||||
}
 | 
			
		||||
@@ -12,6 +12,4 @@
 | 
			
		||||
extern void initProgress(double);
 | 
			
		||||
extern void printProgress(double);
 | 
			
		||||
extern void stopProgress();
 | 
			
		||||
extern FILE* initResidualWriter(void);
 | 
			
		||||
extern void writeResidual(FILE*, double, double);
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -133,7 +133,7 @@ static void setBoundaryCondition(Solver* s, double* p, int imaxLocal, int jmaxLo
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static double smooth(Solver* s, double* p, double* rhs, int level, Comm* comm)
 | 
			
		||||
static void smooth(Solver* s, double* p, double* rhs, int level, Comm* comm)
 | 
			
		||||
{
 | 
			
		||||
    int imaxLocal = comm->imaxLocal;
 | 
			
		||||
    int jmaxLocal = comm->jmaxLocal;
 | 
			
		||||
@@ -253,6 +253,8 @@ static double multiGrid(Solver* s, double* p, double* rhs, int level, Comm* comm
 | 
			
		||||
    // restrict
 | 
			
		||||
    restrictMG(s, level, comm);
 | 
			
		||||
 | 
			
		||||
    // Create a new comm object withupdated imaxLocal and jmaxLocal
 | 
			
		||||
    // along with their updated bufferTypes, sdispls, rdispls
 | 
			
		||||
    Comm newcomm;
 | 
			
		||||
    commUpdateDatatypes(s->comm, &newcomm, comm->imaxLocal / 2, comm->jmaxLocal / 2);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
# Supported: GCC, CLANG, ICC
 | 
			
		||||
TAG ?= ICC
 | 
			
		||||
# Supported: GCC, CLANG, ICX
 | 
			
		||||
TAG ?= ICX
 | 
			
		||||
ENABLE_OPENMP ?= false
 | 
			
		||||
# Supported: sor, rb, mg
 | 
			
		||||
SOLVER ?= mg
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ OPENMP   = -qopenmp
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
VERSION  = --version
 | 
			
		||||
CFLAGS   =  -O3 -xHost -qopt-zmm-usage=high -std=c99 $(OPENMP)
 | 
			
		||||
CFLAGS   =  -O3 -xHost -qopt-zmm-usage=high -std=c99 $(OPENMP) -Wno-unused-command-line-argument
 | 
			
		||||
LFLAGS   = $(OPENMP)
 | 
			
		||||
DEFINES  = -D_GNU_SOURCE
 | 
			
		||||
INCLUDES =
 | 
			
		||||
@@ -15,6 +15,25 @@
 | 
			
		||||
#include "solver.h"
 | 
			
		||||
#include "timing.h"
 | 
			
		||||
 | 
			
		||||
static FILE* initResidualWriter()
 | 
			
		||||
{
 | 
			
		||||
    FILE* fp;
 | 
			
		||||
    fp = fopen("residual.dat", "w");
 | 
			
		||||
 | 
			
		||||
    if (fp == NULL) {
 | 
			
		||||
        printf("Error!\n");
 | 
			
		||||
        exit(EXIT_FAILURE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return fp;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void writeResidual(FILE* fp, double ts, double res)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(fp, "%f, %f\n", ts, res);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main(int argc, char** argv)
 | 
			
		||||
{
 | 
			
		||||
    double timeStart, timeStop;
 | 
			
		||||
 
 | 
			
		||||
@@ -49,21 +49,3 @@ void stopProgress()
 | 
			
		||||
    printf("\n");
 | 
			
		||||
    fflush(stdout);
 | 
			
		||||
}
 | 
			
		||||
FILE* initResidualWriter()
 | 
			
		||||
{
 | 
			
		||||
    FILE* fp;
 | 
			
		||||
    fp = fopen("residual.dat", "w");
 | 
			
		||||
 | 
			
		||||
    if (fp == NULL) {
 | 
			
		||||
        printf("Error!\n");
 | 
			
		||||
        exit(EXIT_FAILURE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return fp;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void writeResidual(FILE* fp, double ts, double res)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(fp, "%f, %f\n", ts, res);
 | 
			
		||||
}
 | 
			
		||||
@@ -10,6 +10,4 @@
 | 
			
		||||
extern void initProgress(double);
 | 
			
		||||
extern void printProgress(double);
 | 
			
		||||
extern void stopProgress(void);
 | 
			
		||||
extern FILE* initResidualWriter(void);
 | 
			
		||||
extern void writeResidual(FILE*, double, double);
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
# Supported: GCC, CLANG, ICC
 | 
			
		||||
TAG ?= ICC
 | 
			
		||||
# Supported: GCC, CLANG, ICX
 | 
			
		||||
TAG ?= ICX
 | 
			
		||||
# Supported: true, false
 | 
			
		||||
ENABLE_MPI ?= true
 | 
			
		||||
ENABLE_OPENMP ?= false
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
ifeq ($(ENABLE_MPI),true)
 | 
			
		||||
CC = mpiicc
 | 
			
		||||
CC = mpiicx
 | 
			
		||||
DEFINES  = -D_MPI
 | 
			
		||||
else
 | 
			
		||||
CC = icc
 | 
			
		||||
CC = icx
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
GCC = gcc
 | 
			
		||||
@@ -13,7 +13,7 @@ OPENMP   = -qopenmp
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
VERSION  = --version
 | 
			
		||||
CFLAGS   =  -O3 -qopt-zmm-usage=high -std=c99 $(OPENMP) -xHost
 | 
			
		||||
CFLAGS   =  -O3 -qopt-zmm-usage=high -std=c99 $(OPENMP) -xHost -Wno-unused-command-line-argument
 | 
			
		||||
LFLAGS   = $(OPENMP)
 | 
			
		||||
DEFINES  += -D_GNU_SOURCE# -DDEBUG
 | 
			
		||||
INCLUDES =
 | 
			
		||||
@@ -17,6 +17,24 @@
 | 
			
		||||
#include "timing.h"
 | 
			
		||||
#include "vtkWriter.h"
 | 
			
		||||
 | 
			
		||||
static FILE* initResidualWriter()
 | 
			
		||||
{
 | 
			
		||||
    FILE* fp;
 | 
			
		||||
    fp = fopen("residual.dat", "w");
 | 
			
		||||
 | 
			
		||||
    if (fp == NULL) {
 | 
			
		||||
        printf("Error!\n");
 | 
			
		||||
        exit(EXIT_FAILURE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return fp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void writeResidual(FILE* fp, double ts, double res)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(fp, "%f, %f\n", ts, res);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main(int argc, char** argv)
 | 
			
		||||
{
 | 
			
		||||
    double timeStart, timeStop;
 | 
			
		||||
@@ -46,7 +64,6 @@ int main(int argc, char** argv)
 | 
			
		||||
    initSolver(&s, &d, &p);
 | 
			
		||||
    initParticleTracer(&particletracer, &p, &d);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef VERBOSE
 | 
			
		||||
    initProgress(d.te);
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -49,17 +49,3 @@ void stopProgress()
 | 
			
		||||
    fflush(stdout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FILE* initResidualWriter()
 | 
			
		||||
{
 | 
			
		||||
    FILE* fp;
 | 
			
		||||
    fp = fopen("residual.dat", "w");
 | 
			
		||||
 | 
			
		||||
    if (fp == NULL) {
 | 
			
		||||
        printf("Error!\n");
 | 
			
		||||
        exit(EXIT_FAILURE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return fp;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void writeResidual(FILE* fp, double ts, double res) { fprintf(fp, "%f, %f\n", ts, res); }
 | 
			
		||||
@@ -12,6 +12,5 @@
 | 
			
		||||
extern void initProgress(double);
 | 
			
		||||
extern void printProgress(double);
 | 
			
		||||
extern void stopProgress(void);
 | 
			
		||||
extern FILE* initResidualWriter(void);
 | 
			
		||||
extern void writeResidual(FILE*, double, double);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -172,7 +172,7 @@ static void setBoundaryCondition(
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static double smooth(Solver* s, double* p, double* rhs, int level, Comm* comm)
 | 
			
		||||
static void smooth(Solver* s, double* p, double* rhs, int level, Comm* comm)
 | 
			
		||||
{
 | 
			
		||||
    int imaxLocal = comm->imaxLocal;
 | 
			
		||||
    int jmaxLocal = comm->jmaxLocal;
 | 
			
		||||
@@ -316,6 +316,8 @@ static double multiGrid(Solver* s, double* p, double* rhs, int level, Comm* comm
 | 
			
		||||
    // restrict
 | 
			
		||||
    restrictMG(s, level, comm);
 | 
			
		||||
 | 
			
		||||
    // Create a new comm object withupdated imaxLocal and jmaxLocal
 | 
			
		||||
    // along with their updated bufferTypes, sdispls, rdispls
 | 
			
		||||
    Comm newcomm;
 | 
			
		||||
    commUpdateDatatypes(s->comm, &newcomm, imaxLocal, jmaxLocal, kmaxLocal);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
# Supported: GCC, CLANG, ICC
 | 
			
		||||
TAG ?= ICC
 | 
			
		||||
# Supported: GCC, CLANG, ICX
 | 
			
		||||
TAG ?= ICX
 | 
			
		||||
ENABLE_OPENMP ?= false
 | 
			
		||||
# Supported: rb, mg
 | 
			
		||||
SOLVER ?= mg
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
CC   = icc
 | 
			
		||||
CC   = icx
 | 
			
		||||
GCC  = gcc
 | 
			
		||||
LINKER = $(CC)
 | 
			
		||||
 | 
			
		||||
@@ -7,7 +7,7 @@ OPENMP   = -qopenmp
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
VERSION  = --version
 | 
			
		||||
CFLAGS   =  -O3 -xHost -qopt-zmm-usage=high -std=c99 $(OPENMP)
 | 
			
		||||
CFLAGS   =  -O3 -xHost -qopt-zmm-usage=high -std=c99 $(OPENMP) -Wno-unused-command-line-argument
 | 
			
		||||
LFLAGS   = $(OPENMP)
 | 
			
		||||
DEFINES  = -D_GNU_SOURCE
 | 
			
		||||
INCLUDES =
 | 
			
		||||
@@ -19,6 +19,25 @@
 | 
			
		||||
 | 
			
		||||
#define G(v, i, j, k) v[(k) * (imax + 2) * (jmax + 2) + (j) * (imax + 2) + (i)]
 | 
			
		||||
 | 
			
		||||
static FILE* initResidualWriter()
 | 
			
		||||
{
 | 
			
		||||
    FILE* fp;
 | 
			
		||||
    fp = fopen("residual.dat", "w");
 | 
			
		||||
 | 
			
		||||
    if (fp == NULL) {
 | 
			
		||||
        printf("Error!\n");
 | 
			
		||||
        exit(EXIT_FAILURE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return fp;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void writeResidual(FILE* fp, double ts, double res)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(fp, "%f, %f\n", ts, res);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void createBulkArrays(
 | 
			
		||||
    Discretization* s, double* pg, double* ug, double* vg, double* wg)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -50,21 +50,3 @@ void stopProgress()
 | 
			
		||||
    fflush(stdout);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
FILE* initResidualWriter()
 | 
			
		||||
{
 | 
			
		||||
    FILE* fp;
 | 
			
		||||
    fp = fopen("residual.dat", "w");
 | 
			
		||||
 | 
			
		||||
    if (fp == NULL) {
 | 
			
		||||
        printf("Error!\n");
 | 
			
		||||
        exit(EXIT_FAILURE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return fp;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void writeResidual(FILE* fp, double ts, double res)
 | 
			
		||||
{
 | 
			
		||||
    fprintf(fp, "%f, %f\n", ts, res);
 | 
			
		||||
}
 | 
			
		||||
@@ -10,6 +10,5 @@
 | 
			
		||||
extern void initProgress(double);
 | 
			
		||||
extern void printProgress(double);
 | 
			
		||||
extern void stopProgress(void);
 | 
			
		||||
extern FILE* initResidualWriter(void);
 | 
			
		||||
extern void writeResidual(FILE*, double, double);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -112,7 +112,7 @@ static void setBoundaryCondition(double* p, int imax, int jmax, int kmax)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static double smooth(
 | 
			
		||||
static void smooth(
 | 
			
		||||
    Solver* s, double* p, double* rhs, int level, int imax, int jmax, int kmax)
 | 
			
		||||
{
 | 
			
		||||
    double eps    = s->eps;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user