Allow changing physical_vector_size via scons

parent 2715e5a9
...@@ -46,6 +46,18 @@ print '' ...@@ -46,6 +46,18 @@ print ''
import os import os
def isInt(key, value, env):
"""Makes sure value is an integer"""
try:
int(value)
except ValueError:
return False
return True
def toInt(value):
return int(value)
# #
# set possible variables # set possible variables
# #
...@@ -101,6 +113,8 @@ vars.AddVariables( ...@@ -101,6 +113,8 @@ vars.AddVariables(
EnumVariable( 'platform', 'compile for a specific platform (Intel compiler only', 'default', EnumVariable( 'platform', 'compile for a specific platform (Intel compiler only', 'default',
allowed_values=('default', 'mic' ) allowed_values=('default', 'mic' )
), ),
('physicalVectorSize', 'size of vector registers is bits', 128, isInt, toInt),
BoolVariable( 'xmlRuntime', 'use a xml-file for runtime parameters', False ) BoolVariable( 'xmlRuntime', 'use a xml-file for runtime parameters', False )
) )
...@@ -210,7 +224,7 @@ elif env['solver'] == 'augrie': ...@@ -210,7 +224,7 @@ elif env['solver'] == 'augrie':
elif env['solver'] == 'hybrid': elif env['solver'] == 'hybrid':
env.Append(CPPDEFINES=['WAVE_PROPAGATION_SOLVER=0']) env.Append(CPPDEFINES=['WAVE_PROPAGATION_SOLVER=0'])
elif env['solver'] == 'fwavevec': elif env['solver'] == 'fwavevec':
env.Append(CPPDEFINES=['WAVE_PROPAGATION_SOLVER=4']) env.Append(CPPDEFINES=['WAVE_PROPAGATION_SOLVER=4', 'PHYSICAL_VECTOR_SIZE='+str(env['physicalVectorSize'])])
# set the precompiler flags for serial version # set the precompiler flags for serial version
if env['parallelization'] in ['none', 'cuda']: if env['parallelization'] in ['none', 'cuda']:
......
...@@ -34,11 +34,6 @@ ...@@ -34,11 +34,6 @@
#include <omp.h> #include <omp.h>
#endif #endif
#ifndef PHYSICAL_VECTOR_SIZE
#define PHYSICAL_VECTOR_SIZE 128
#endif
#include <cstdlib>
#if WAVE_PROPAGATION_SOLVER==4 #if WAVE_PROPAGATION_SOLVER==4
/** The number of floats that fit in one vector register */ /** The number of floats that fit in one vector register */
#define VECTOR_LENGTH (PHYSICAL_VECTOR_SIZE/8/sizeof(float)) #define VECTOR_LENGTH (PHYSICAL_VECTOR_SIZE/8/sizeof(float))
......
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