From 8bcc26a9f9de6f02f044122b129d785ac8b905f5 Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Thu, 3 Jan 2013 15:48:52 +0100 Subject: [PATCH] janitorial work --- libsharp/planck.make | 2 +- libsharp/sharp_core.c | 12 ++++++------ libsharp/sharp_core_inc.c | 6 +++--- .../{sharp_core_inc4.c => sharp_core_inc2.c} | 2 +- ...p_inchelper1.inc.c => sharp_core_inchelper.c} | 16 ++++++++-------- libsharp/sharp_geomhelpers.h | 3 ++- libsharp/sharp_testsuite.c | 9 +++++---- 7 files changed, 26 insertions(+), 24 deletions(-) rename libsharp/{sharp_core_inc4.c => sharp_core_inc2.c} (99%) rename libsharp/{sharp_inchelper1.inc.c => sharp_core_inchelper.c} (82%) diff --git a/libsharp/planck.make b/libsharp/planck.make index bb1ee3c..3397422 100644 --- a/libsharp/planck.make +++ b/libsharp/planck.make @@ -14,7 +14,7 @@ LIBOBJ:=$(LIBOBJ:%=$(OD)/%) ALLOBJ:=$(ALLOBJ:%=$(OD)/%) ODEP:=$(HDR_$(PKG)) $(HDR_libfftpack) $(HDR_c_utils) -$(OD)/sharp_core.o: $(SD)/sharp_inchelper1.inc.c $(SD)/sharp_core_inc.c $(SD)/sharp_core_inc4.c +$(OD)/sharp_core.o: $(SD)/sharp_core_inchelper.c $(SD)/sharp_core_inc.c $(SD)/sharp_core_inc2.c $(OD)/sharp.o: $(SD)/sharp_mpi.c BDEP:=$(LIB_$(PKG)) $(LIB_libfftpack) $(LIB_c_utils) diff --git a/libsharp/sharp_core.c b/libsharp/sharp_core.c index 717deed..9931859 100644 --- a/libsharp/sharp_core.c +++ b/libsharp/sharp_core.c @@ -50,27 +50,27 @@ typedef complex double dcmplx; #define CONCAT3(a,b,c) XCONCAT3(a,b,c) #define nvec 1 -#include "sharp_inchelper1.inc.c" +#include "sharp_core_inchelper.c" #undef nvec #define nvec 2 -#include "sharp_inchelper1.inc.c" +#include "sharp_core_inchelper.c" #undef nvec #define nvec 3 -#include "sharp_inchelper1.inc.c" +#include "sharp_core_inchelper.c" #undef nvec #define nvec 4 -#include "sharp_inchelper1.inc.c" +#include "sharp_core_inchelper.c" #undef nvec #define nvec 5 -#include "sharp_inchelper1.inc.c" +#include "sharp_core_inchelper.c" #undef nvec #define nvec 6 -#include "sharp_inchelper1.inc.c" +#include "sharp_core_inchelper.c" #undef nvec void inner_loop (sharp_job *job, const int *ispair,const double *cth, diff --git a/libsharp/sharp_core_inc.c b/libsharp/sharp_core_inc.c index e87c817..22e8cad 100644 --- a/libsharp/sharp_core_inc.c +++ b/libsharp/sharp_core_inc.c @@ -70,7 +70,7 @@ static inline Tb Y(Tbprod)(Tb a, Tb b) static inline void Y(Tbmuleq)(Tb * restrict a, Tb b) { for (int i=0; iv[i],b.v[i]); } -static inline void Y(Tbnormalize) (Tb * restrict val, Tb * restrict scale, +static void Y(Tbnormalize) (Tb * restrict val, Tb * restrict scale, double maxval) { const Tv vfsmall=vload(sharp_fsmall), vfbig=vload(sharp_fbig); @@ -94,7 +94,7 @@ static inline void Y(Tbnormalize) (Tb * restrict val, Tb * restrict scale, } } -static inline void Y(mypow) (Tb val, int npow, Tb * restrict resd, +static void Y(mypow) (Tb val, int npow, Tb * restrict resd, Tb * restrict ress) { Tb scale=Y(Tbconst)(0.), scaleint=Y(Tbconst)(0.), res=Y(Tbconst)(1.); @@ -168,7 +168,7 @@ static inline int Y(TballGe)(Tb a,double b) return vallTrue(res); } -static inline void Y(getCorfac)(Tb scale, Tb * restrict corfac, +static void Y(getCorfac)(Tb scale, Tb * restrict corfac, const double * restrict cf) { Y(Tbu) sc, corf; diff --git a/libsharp/sharp_core_inc4.c b/libsharp/sharp_core_inc2.c similarity index 99% rename from libsharp/sharp_core_inc4.c rename to libsharp/sharp_core_inc2.c index e36527f..63d2e4a 100644 --- a/libsharp/sharp_core_inc4.c +++ b/libsharp/sharp_core_inc2.c @@ -22,7 +22,7 @@ * (DLR). */ -/*! \file sharp_core_inc4.c +/*! \file sharp_core_inc2.c * Type-dependent code for the computational core * * Copyright (C) 2012 Max-Planck-Society diff --git a/libsharp/sharp_inchelper1.inc.c b/libsharp/sharp_core_inchelper.c similarity index 82% rename from libsharp/sharp_inchelper1.inc.c rename to libsharp/sharp_core_inchelper.c index 131ee4e..89d79cd 100644 --- a/libsharp/sharp_inchelper1.inc.c +++ b/libsharp/sharp_core_inchelper.c @@ -3,10 +3,10 @@ #include "sharp_core_inc.c" #if (SHARP_MAXTRANS>MAXJOB_SPECIAL) -#define NJ1 ,int njobs +#define NJ1 , int njobs #define NJ2 , njobs #define Z(arg) CONCAT2(arg,nvec) -#include "sharp_core_inc4.c" +#include "sharp_core_inc2.c" #undef Z #undef NJ1 #undef NJ2 @@ -18,7 +18,7 @@ #if ((MAXJOB_SPECIAL>=1)&&(SHARP_MAXTRANS>=1)) #define njobs 1 #define Z(arg) CONCAT3(arg,nvec,njobs) -#include "sharp_core_inc4.c" +#include "sharp_core_inc2.c" #undef Z #undef njobs #endif @@ -26,7 +26,7 @@ #if ((MAXJOB_SPECIAL>=2)&&(SHARP_MAXTRANS>=2)) #define njobs 2 #define Z(arg) CONCAT3(arg,nvec,njobs) -#include "sharp_core_inc4.c" +#include "sharp_core_inc2.c" #undef Z #undef njobs #endif @@ -34,7 +34,7 @@ #if ((MAXJOB_SPECIAL>=3)&&(SHARP_MAXTRANS>=3)) #define njobs 3 #define Z(arg) CONCAT3(arg,nvec,njobs) -#include "sharp_core_inc4.c" +#include "sharp_core_inc2.c" #undef Z #undef njobs #endif @@ -42,7 +42,7 @@ #if ((MAXJOB_SPECIAL>=4)&&(SHARP_MAXTRANS>=4)) #define njobs 4 #define Z(arg) CONCAT3(arg,nvec,njobs) -#include "sharp_core_inc4.c" +#include "sharp_core_inc2.c" #undef Z #undef njobs #endif @@ -50,7 +50,7 @@ #if ((MAXJOB_SPECIAL>=5)&&(SHARP_MAXTRANS>=5)) #define njobs 5 #define Z(arg) CONCAT3(arg,nvec,njobs) -#include "sharp_core_inc4.c" +#include "sharp_core_inc2.c" #undef Z #undef njobs #endif @@ -58,7 +58,7 @@ #if ((MAXJOB_SPECIAL>=6)&&(SHARP_MAXTRANS>=6)) #define njobs 6 #define Z(arg) CONCAT3(arg,nvec,njobs) -#include "sharp_core_inc4.c" +#include "sharp_core_inc2.c" #undef Z #undef njobs #endif diff --git a/libsharp/sharp_geomhelpers.h b/libsharp/sharp_geomhelpers.h index 0c9e89b..136af52 100644 --- a/libsharp/sharp_geomhelpers.h +++ b/libsharp/sharp_geomhelpers.h @@ -79,7 +79,8 @@ void sharp_make_gauss_geom_info (int nrings, int nphi, double phi0, void sharp_make_fejer1_geom_info (int nrings, int nphi, double phi0, int stride_lon, int stride_lat, sharp_geom_info **geom_info); -/*! Old name for sharp_make_fejer1_geom_info() */ +/*! Old name for sharp_make_fejer1_geom_info() + \ingroup geominfogroup */ static inline void sharp_make_ecp_geom_info (int nrings, int nphi, double phi0, int stride_lon, int stride_lat, sharp_geom_info **geom_info) { diff --git a/libsharp/sharp_testsuite.c b/libsharp/sharp_testsuite.c index 4b986fc..b3efe57 100644 --- a/libsharp/sharp_testsuite.c +++ b/libsharp/sharp_testsuite.c @@ -154,11 +154,12 @@ static void get_errors (dcmplx **alm, ptrdiff_t nalms, int ncomp, double *sqsum, double sum=0, maxdiff=0, sumtot, sqsumtot, maxdifftot; for (ptrdiff_t j=0; jmaxdiff) maxdiff=fabs(creal(alm[i][j])); - if (fabs(cimag(alm[i][j]))>maxdiff) maxdiff=fabs(cimag(alm[i][j])); + double sqr=creal(alm[i][j])*creal(alm[i][j]) + +cimag(alm[i][j])*cimag(alm[i][j]); + sum+=sqr; + if (sqr>maxdiff) maxdiff=sqr; } + maxdiff=sqrt(maxdiff); #ifdef USE_MPI MPI_Allreduce(&sum,&sumtot,1,MPI_DOUBLE,MPI_SUM,MPI_COMM_WORLD);