Commit 9d72f317 authored by dino's avatar dino
Browse files

Minor changes in the macro to align the arrays to use the SSE extensions

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1118 170316e4-aea8-4b27-aad4-0380ec0519c9
parent b76bb0ad
......@@ -6,8 +6,7 @@
#include "SignalBasis.h"
#ifdef USE_SSE_VERSION // defined in GridSearchParams.h
#include <xmmintrin.h>
#include <tmmintrin.h>
#include <tmmintrin.h> // SS3 and all preceding stuff
#endif
//#define SPECMETRICS // to produce specMetrics in SearchFullGrid and SearchAdaptive ==> will be very slow and is not thread-safe
......
......@@ -7,15 +7,16 @@
#include <cmath>
#include <string.h>
// macro for aligning data on 16 byte boundary (page 109 in agner.org/optimize/optimizing_cpp.pfd)
#ifndef USE_SSE_VERSION
# define GS_MEMALIGN_16
# define GSALIGN16(vv) vv
#else
# if defined(__GNUC__)
# define GS_MEMALIGN_16 __attribute__((aligned(16)))
# define GSALIGN16(vv) vv __attribute__((aligned(16)))
# elif defined(_MSC_VER)
# define GS_MEMALIGN_16 __declspec(align(16))
# define GSALIGN16(vv) __declspec(align(16)) vv
# else
# define GS_MEMALIGN_16
# define GSALIGN16(vv) vv
# endif
#endif
......@@ -45,8 +46,7 @@ class pointPsa
public:
float x, y, z; // coordinates of the interaction (mm)
int netChargeSegment; // its net-charge segment
GS_MEMALIGN_16 // compiler-specific alignment directive
float amplitude[TCHAN][NTIME]; // 36 segments + CC + non differentiated copies of net-charge segment and the core
GSALIGN16(float amplitude[TCHAN][NTIME]); // 36 segments + CC + non differentiated copies of net-charge segment and the core
int addr_first; // valid/useful start of the amplitude
int addr_last; // valid/useful last of the amplitude (margin included)
float sumTransients; // sum of all transient signals
......@@ -408,14 +408,11 @@ public:
int numNetCharges;
int netChargeSegnum[NSEGS]; // normally given in the order of energy release
float netChargeEnergy[NSEGS];
GS_MEMALIGN_16
float tAmplitude[TCHAN][NTIME]; // the total original experimental data
GS_MEMALIGN_16
float wAmplitude[TCHAN][NTIME]; // the experimental data to be used and modified by the grid search
GS_MEMALIGN_16
float sAmplitude[TCHAN][NTIME]; // experimental trace manipulated for being used by the "chi2" loops
GS_MEMALIGN_16
float rAmplitude[TCHAN][NTIME]; // the "fitted" trace
GSALIGN16(float tAmplitude[TCHAN][NTIME]); // the total original experimental data
GSALIGN16(float wAmplitude[TCHAN][NTIME]); // the experimental data to be used and modified by the grid search
GSALIGN16(float sAmplitude[TCHAN][NTIME]); // experimental trace manipulated for being used by the "chi2" loops
GSALIGN16(float rAmplitude[TCHAN][NTIME]); // the "fitted" trace
int resPt1[NSEGS]; // the best 1st solution point for the numNetCharges segments
int resPt2[NSEGS]; // the best 2nd solution point "
......
......@@ -52,12 +52,16 @@ const float MAXNORM = 1000.f; // normalization of the signal basis
// We should check this in PSAFilterGridSearch or, maybe, go back to the formulation by
// Roberto Venturelli where the experimental signal is rescaled event-by-event to MAXNORM.
#ifdef HAS_AGAPROCONFIG
#ifdef HAS_SSE
#define USE_SSE_VERSION // automatic through cmake
#endif
#else
#define USE_SSE_VERSION // uncomment to use SSE intrinsics for the innermost figure-of-merit loop
// This define should be managed at the project level (VC or cmake -DUSE_SSE_VERSION=1 or CmakeLists.txt)
// However, during development it is convenient to control it directly to avoid full recompilation if changing the project)
#if 0
#ifdef HAS_AGAPROCONFIG
#ifdef HAS_SSE
#define USE_SSE_VERSION // automatic through cmake
#endif
#else
#define USE_SSE_VERSION // uncomment to use SSE intrinsics for the innermost figure-of-merit loop
#endif
#endif
// the vectorized version only for the standard values .._MODULO, .._SQUARE, .._1SQRT, .._2SQRT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment