diff --git a/c_utils/c_utils.c b/c_utils/c_utils.c index d8601e75e5702bd2ae9efce26764e45f13fb1fd7..96bd76584c028a91773bd8c65ab144ba45825e27 100644 --- a/c_utils/c_utils.c +++ b/c_utils/c_utils.c @@ -25,21 +25,12 @@ /* * Convenience functions * - * Copyright (C) 2008, 2009, 2010, 2011 Max-Planck-Society + * Copyright (C) 2008, 2009, 2010, 2011, 2012 Max-Planck-Society * Author: Martin Reinecke */ #include <stdio.h> -#include <stdlib.h> -#include <string.h> #include "c_utils.h" -#include "vec_utils.h" -#ifdef _OPENMP -#include <omp.h> -#endif -#ifdef USE_MPI -#include <mpi.h> -#endif void util_fail_ (const char *file, int line, const char *func, const char *msg) { @@ -88,58 +79,3 @@ void *util_malloc_ (size_t sz) void util_free_ (void *ptr) { if ((ptr)!=NULL) free(ptr); } #endif - -static void OpenMP_status(void) - { -#ifndef _OPENMP - printf("OpenMP: not supported by this binary\n"); -#else - int threads = omp_get_max_threads(); - if (threads>1) - printf("OpenMP active: max. %d threads.\n",threads); - else - printf("OpenMP active, but running with 1 thread only.\n"); -#endif - } - -static void MPI_status(void) - { -#ifndef USE_MPI - printf("MPI: not supported by this binary\n"); -#else - int tasks; - MPI_Comm_size(MPI_COMM_WORLD,&tasks); - if (tasks>1) - printf("MPI active with %d tasks.\n",tasks); - else - printf("MPI active, but running with 1 task only.\n"); -#endif - } - -static void vecmath_status(void) - { printf("Supported vector length: %d\n",VLEN); } - -void announce_c (const char *name) - { - size_t m, nlen=strlen(name); - printf("\n+-"); - for (m=0; m<nlen; ++m) printf("-"); - printf("-+\n"); - printf("| %s |\n", name); - printf("+-"); - for (m=0; m<nlen; ++m) printf("-"); - printf("-+\n\n"); - vecmath_status(); - OpenMP_status(); - MPI_status(); - printf("\n"); - } - -void module_startup_c (const char *name, int argc, int argc_expected, - const char *argv_expected, int verbose) - { - if (verbose) announce_c (name); - if (argc==argc_expected) return; - if (verbose) fprintf(stderr, "Usage: %s %s\n", name, argv_expected); - exit(1); - } diff --git a/c_utils/c_utils.h b/c_utils/c_utils.h index db6059c8e7838eff3b5d3c687fd5023e027d8204..768d2b755975c3f3c979936692c39d15508389bd 100644 --- a/c_utils/c_utils.h +++ b/c_utils/c_utils.h @@ -46,10 +46,6 @@ void util_warn_ (const char *file, int line, const char *func, const char *msg); void *util_malloc_ (size_t sz); void util_free_ (void *ptr); -void announce_c (const char *name); -void module_startup_c (const char *name, int argc, int argc_expected, - const char *argv_expected, int verbose); - #if defined (__GNUC__) #define UTIL_FUNC_NAME__ __func__ #else diff --git a/libsharp/oracle.inc b/libsharp/oracle.inc index 7680861bad0dc9c634498a60231b6df811671f11..a9777295b15f283eeaf3aad54fa5a81199e3c524 100644 --- a/libsharp/oracle.inc +++ b/libsharp/oracle.inc @@ -2,7 +2,7 @@ static const int maxtr = 6; static const int nv_opt[6][2][3] = { {{4,2,-1},{2,1,-1}}, {{4,2,-1},{2,1,-1}}, -{{5,2,-1},{5,2,-1}}, +{{5,2,-1},{5,1,-1}}, {{5,2,-1},{5,2,-1}}, {{5,2,-1},{5,2,-1}}, {{5,2,-1},{5,2,-1}} diff --git a/libsharp/planck.make b/libsharp/planck.make index 23dd2adb6bc13ced6137b7a5b042454ffc994406..c8621cdf0a441ea20de554406ac93f026458b7aa 100644 --- a/libsharp/planck.make +++ b/libsharp/planck.make @@ -8,7 +8,7 @@ FULL_INCLUDE+= -I$(SD) HDR_$(PKG):=$(SD)/*.h LIB_$(PKG):=$(LIBDIR)/libsharp.a BIN:=sharp_test sharp_acctest sharp_test_mpi sharp_bench -LIBOBJ:=ylmgen_c.o sharp.o sharp_geomhelpers.o sharp_almhelpers.o sharp_core.o +LIBOBJ:=sharp_ylmgen_c.o sharp.o sharp_announce.o sharp_geomhelpers.o sharp_almhelpers.o sharp_core.o ALLOBJ:=$(LIBOBJ) sharp_test.o sharp_acctest.o sharp_test_mpi.o sharp_bench.o LIBOBJ:=$(LIBOBJ:%=$(OD)/%) ALLOBJ:=$(ALLOBJ:%=$(OD)/%) diff --git a/libsharp/sharp.c b/libsharp/sharp.c index 6f44ffad2c5acedc5d22baa0e8046121bfb4201a..e3d7a89d81cc16db0c26c0bb93348ee1d59479ff 100644 --- a/libsharp/sharp.c +++ b/libsharp/sharp.c @@ -31,11 +31,11 @@ #include <math.h> #include "ls_fft.h" -#include "ylmgen_c.h" +#include "sharp_ylmgen_c.h" #include "sharp.h" #include "c_utils.h" #include "sharp_core.h" -#include "vec_utils.h" +#include "sharp_vecutil.h" #include "walltime_c.h" typedef complex double dcmplx; diff --git a/libsharp/sharp_acctest.c b/libsharp/sharp_acctest.c index 3f368773b04e5407803a8c12988d930a96c933a5..37ee25bc11b87560dc34612d20100088f67621eb 100644 --- a/libsharp/sharp_acctest.c +++ b/libsharp/sharp_acctest.c @@ -38,6 +38,7 @@ #include "sharp_geomhelpers.h" #include "sharp_almhelpers.h" #include "c_utils.h" +#include "sharp_announce.h" #include "sharp_core.h" typedef complex double dcmplx; @@ -183,7 +184,7 @@ int main(void) #ifdef USE_MPI MPI_Init(NULL,NULL); #endif - module_startup_c("sharp_acctest",1,1,"",1); + sharp_module_startup("sharp_acctest",1,1,"",1); int lmax=127; diff --git a/libsharp/sharp_bench.c b/libsharp/sharp_bench.c index 185dc9e50de42d389671dc1b81583185a9bd400c..b578b392474d741c7dcbe3b411c501371d6aaeae 100644 --- a/libsharp/sharp_bench.c +++ b/libsharp/sharp_bench.c @@ -36,6 +36,7 @@ #include "sharp_geomhelpers.h" #include "sharp_almhelpers.h" #include "c_utils.h" +#include "sharp_announce.h" #include "sharp_core.h" typedef complex double dcmplx; @@ -94,7 +95,7 @@ int main(void) #ifdef USE_MPI MPI_Init(NULL,NULL); #endif - module_startup_c("sharp_bench",1,1,"",1); + sharp_module_startup("sharp_bench",1,1,"",1); printf("Benchmarking SHTs.\n\n"); FILE *fp=fopen("oracle.inc","w"); diff --git a/libsharp/sharp_complex_hacks.h b/libsharp/sharp_complex_hacks.h index 99a7c2b2921aa58ef8088465f15bfad690ae6a23..d06741ec6b80bf2065427940ce416ec51eb30ee0 100644 --- a/libsharp/sharp_complex_hacks.h +++ b/libsharp/sharp_complex_hacks.h @@ -22,19 +22,19 @@ * (DLR). */ -/* \file complex_hacks.h +/* \file sharp_complex_hacks.h * support for converting vector types and complex numbers * * Copyright (C) 2012 Max-Planck-Society * Author: Martin Reinecke */ -#ifndef COMPLEX_HACKS_H -#define COMPLEX_HACKS_H +#ifndef SHARP_COMPLEX_HACKS_H +#define SHARP_COMPLEX_HACKS_H #include <math.h> #include <complex.h> -#include "vecsupport.h" +#include "sharp_vecsupport.h" #define UNSAFE_CODE diff --git a/libsharp/sharp_core.c b/libsharp/sharp_core.c index ba5cd88b62921042bd0edeb2e7427c2b2fd83a90..ec0297549e12fc44cc8d6e099860b514a2d5aca2 100644 --- a/libsharp/sharp_core.c +++ b/libsharp/sharp_core.c @@ -32,9 +32,9 @@ #include <complex.h> #include <math.h> #include <string.h> -#include "vecsupport.h" -#include "complex_hacks.h" -#include "ylmgen_c.h" +#include "sharp_vecsupport.h" +#include "sharp_complex_hacks.h" +#include "sharp_ylmgen_c.h" #include "sharp.h" #include "sharp_core.h" #include "c_utils.h" diff --git a/libsharp/sharp_core.h b/libsharp/sharp_core.h index 0699074ab95246d89c1ee9069aef042d61e99410..38ec41da91d75d00afb0fbb9cdd5fc5173e8380b 100644 --- a/libsharp/sharp_core.h +++ b/libsharp/sharp_core.h @@ -33,7 +33,7 @@ #define PLANCK_SHARP_CORE_H #include "sharp.h" -#include "ylmgen_c.h" +#include "sharp_ylmgen_c.h" #ifdef __cplusplus extern "C" { diff --git a/libsharp/sharp_test.c b/libsharp/sharp_test.c index 6bcd2537be0f34c34e2909d3bd3617f6dffc063b..bd0fe28f31079ca7fcd0661d73e4c1bc2975ef6f 100644 --- a/libsharp/sharp_test.c +++ b/libsharp/sharp_test.c @@ -59,6 +59,7 @@ #include "sharp_geomhelpers.h" #include "sharp_almhelpers.h" #include "c_utils.h" +#include "sharp_announce.h" #include "sharp_core.h" typedef complex double dcmplx; @@ -188,7 +189,7 @@ int main(int argc, char **argv) #ifdef USE_MPI MPI_Init(NULL,NULL); #endif - module_startup_c("sharp_test",argc,7, + sharp_module_startup("sharp_test",argc,7, "<healpix|ecp|gauss> <lmax> <nside|nphi> <niter> <spin> <ntrans>",1); int lmax=atoi(argv[2]); diff --git a/libsharp/sharp_vecsupport.h b/libsharp/sharp_vecsupport.h index ccb9364d4d8b6b28fd06ebe82d964f32f9a8596f..0fe7540573ec48793097a41f5360f6b766563925 100644 --- a/libsharp/sharp_vecsupport.h +++ b/libsharp/sharp_vecsupport.h @@ -22,18 +22,18 @@ * (DLR). */ -/* \file vecsupport.h +/* \file sharp_vecsupport.h * Convenience functions for vector arithmetics * * Copyright (C) 2012 Max-Planck-Society * Author: Martin Reinecke */ -#ifndef VECSUPPORT_H -#define VECSUPPORT_H +#ifndef SHARP_VECSUPPORT_H +#define SHARP_VECSUPPORT_H #include <math.h> -#include "vec_utils.h" +#include "sharp_vecutil.h" typedef double Ts; diff --git a/libsharp/sharp_vecutil.h b/libsharp/sharp_vecutil.h index 50066f8fb91c21bfa98ac6cdd43731a4f7e8db74..5b64c5abace67e76788ee686644b326019aec2f5 100644 --- a/libsharp/sharp_vecutil.h +++ b/libsharp/sharp_vecutil.h @@ -22,15 +22,15 @@ * (DLR). */ -/*! \file vec_utils.h +/*! \file sharp_vecutil.h * Functionality related to vector instruction support * * Copyright (C) 2012 Max-Planck-Society * \author Martin Reinecke */ -#ifndef PLANCK_VEC_UTILS_H -#define PLANCK_VEC_UTILS_H +#ifndef SHARP_VECUTIL_H +#define SHARP_VECUTIL_H #if (defined (__AVX__) && (!defined (DISABLE_AVX)) && (!defined (DISABLE_SSE2))) #define VLEN 4 diff --git a/libsharp/sharp_ylmgen_c.c b/libsharp/sharp_ylmgen_c.c index e674e6334c0daca161580e1e0cc97b2a1b2fe318..48a1f7b75abea719089f783bc83f2a5ff92eb1c2 100644 --- a/libsharp/sharp_ylmgen_c.c +++ b/libsharp/sharp_ylmgen_c.c @@ -31,7 +31,7 @@ #include <math.h> #include <stdlib.h> -#include "ylmgen_c.h" +#include "sharp_ylmgen_c.h" #include "c_utils.h" void Ylmgen_init (Ylmgen_C *gen, int l_max, int m_max, int spin) diff --git a/libsharp/sharp_ylmgen_c.h b/libsharp/sharp_ylmgen_c.h index 6462478912ed96104db52eb96175e1120bcb585c..cbfd42c317cb20783a54c10478c4668d7f1bc4cd 100644 --- a/libsharp/sharp_ylmgen_c.h +++ b/libsharp/sharp_ylmgen_c.h @@ -22,15 +22,15 @@ * (DLR). */ -/*! \file ylmgen_c.h +/*! \file sharp_ylmgen_c.h * Code for efficient calculation of Y_lm(phi=0,theta) * * Copyright (C) 2005-2012 Max-Planck-Society * \author Martin Reinecke */ -#ifndef PLANCK_YLMGEN_C_H -#define PLANCK_YLMGEN_C_H +#ifndef SHARP_YLMGEN_C_H +#define SHARP_YLMGEN_C_H #ifdef __cplusplus extern "C" {