Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Backofen, Rainer
amdis
Commits
2f05c417
Commit
2f05c417
authored
Mar 19, 2015
by
Praetorius, Simon
Browse files
removed const_cast in operations/product and norm
parent
371a9508
Changes
7
Hide whitespace changes
Inline
Side-by-side
AMDiS/src/config/Config_clang.h
View file @
2f05c417
...
...
@@ -32,6 +32,8 @@
// alignement specification
// ------------------------
#define ALIGNED(type,name,N) type name[N] __attribute__ ((aligned(CACHE_LINE)))
#define ASSUME_ALIGNED(var) __builtin_assume_aligned(var, CACHE_LINE)
typedef
double
aligned_double
__attribute__
((
aligned
(
CACHE_LINE
)));
typedef
float
aligned_float
__attribute__
((
aligned
(
CACHE_LINE
)));
typedef
int
aligned_int
__attribute__
((
aligned
(
CACHE_LINE
)));
...
...
AMDiS/src/config/Config_defaults.h
View file @
2f05c417
...
...
@@ -35,12 +35,18 @@
// ------------------------
#ifndef ALIGNED
#define ALIGNED(type,name,N) type name[N]
#define ASSUME_ALIGNED(var) var
typedef
double
aligned_double
;
typedef
float
aligned_float
;
typedef
int
aligned_int
;
typedef
size_t
aligned_size_t
;
#define ALIGNED_ALLOC(type,size,alignment) new type[size]
#define ALIGNED_FREE(addr) delete [] addr
#endif
#ifndef ALIGNED_ALLOC
// define aligned_malloc and aligned_free somewhere else, before using the macros
#define ALIGNED_ALLOC(type,size,alignment) (type*)aligned_malloc(size*sizeof(type), alignment)
#define ALIGNED_FREE(ptr) aligned_free(ptr)
#endif
// some compiler attributes
...
...
AMDiS/src/config/Config_gcc.h
View file @
2f05c417
...
...
@@ -32,16 +32,13 @@
// alignement specification
// ------------------------
#define ALIGNED(type,name,N) type name[N] __attribute__ ((aligned(CACHE_LINE)))
#define ASSUME_ALIGNED(var) __builtin_assume_aligned(var, CACHE_LINE)
typedef
double
aligned_double
__attribute__
((
aligned
(
CACHE_LINE
)));
typedef
float
aligned_float
__attribute__
((
aligned
(
CACHE_LINE
)));
typedef
int
aligned_int
__attribute__
((
aligned
(
CACHE_LINE
)));
typedef
size_t
aligned_size_t
__attribute__
((
aligned
(
CACHE_LINE
)));
#include
<stdlib.h>
#define ALIGNED_ALLOC(type,size,alignment) (type*)memalign(alignment, size*sizeof(type))
inline
void
aligned_free
(
void
*
p
)
{
void
*
p1
=
((
void
**
)
p
)[
-
1
];
free
(
p1
);
}
#define ALIGNED_FREE(ptr) aligned_free(ptr)
// some compiler attributes
// ------------------------
#define NOINLINE __attribute__ ((noinline))
...
...
AMDiS/src/config/Config_intel.h
View file @
2f05c417
...
...
@@ -33,6 +33,8 @@
// alignement specification
// ------------------------
#define ALIGNED(type,name,N) __declspec(align(CACHE_LINE)) type name[N]
#define ASSUME_ALIGNED(var) var; __assume_aligned(var, CACHE_LINE)
typedef
__declspec
(
align
(
CACHE_LINE
))
double
aligned_double
;
typedef
__declspec
(
align
(
CACHE_LINE
))
float
aligned_float
;
typedef
__declspec
(
align
(
CACHE_LINE
))
int
aligned_int
;
...
...
AMDiS/src/operations/norm.hpp
View file @
2f05c417
...
...
@@ -59,7 +59,7 @@ namespace AMDiS
using
namespace
mtl
::
vector
;
typedef
parameters
<
mtl
::
col_major
,
non_fixed
::
dimension
,
false
,
size_type
>
param
;
mtl
::
dense_vector
<
value_type
,
param
>
tmp
(
AMDiS
::
size
(
v
),
const_cast
<
value_type
*>
(
v
.
begin
())
)
;
mtl
::
dense_vector
<
const
value_type
,
param
>
tmp
(
AMDiS
::
size
(
v
),
value_typev
.
begin
());
return
mtl
::
two_norm
(
tmp
);
}
...
...
@@ -110,7 +110,7 @@ namespace AMDiS
using
namespace
mtl
::
vector
;
typedef
parameters
<
mtl
::
col_major
,
non_fixed
::
dimension
,
false
,
size_type
>
param
;
mtl
::
dense_vector
<
value_type
,
param
>
tmp
(
AMDiS
::
size
(
v
),
const_cast
<
value_type
*>
(
v
.
begin
())
)
;
mtl
::
dense_vector
<
const
value_type
,
param
>
tmp
(
AMDiS
::
size
(
v
),
v
.
begin
());
return
mtl
::
vector
::
one_norm
(
tmp
);
}
...
...
AMDiS/src/operations/product.hpp
View file @
2f05c417
...
...
@@ -64,8 +64,8 @@ namespace AMDiS
using
namespace
mtl
::
vector
;
typedef
parameters
<
mtl
::
col_major
,
non_fixed
::
dimension
,
false
,
size_type1
>
param1
;
typedef
parameters
<
mtl
::
col_major
,
non_fixed
::
dimension
,
false
,
size_type2
>
param2
;
mtl
::
dense_vector
<
value_type1
,
param1
>
tmp1
(
AMDiS
::
size
(
v1
),
const_cast
<
value_type1
*>
(
v1
.
begin
())
)
;
mtl
::
dense_vector
<
value_type2
,
param2
>
tmp2
(
AMDiS
::
size
(
v2
),
const_cast
<
value_type2
*>
(
v2
.
begin
())
)
;
mtl
::
dense_vector
<
const
value_type1
,
param1
>
tmp1
(
AMDiS
::
size
(
v1
),
v1
.
begin
());
mtl
::
dense_vector
<
const
value_type2
,
param2
>
tmp2
(
AMDiS
::
size
(
v2
),
v2
.
begin
());
return
mtl
::
dot
(
tmp1
,
tmp2
);
}
...
...
AMDiS/src/traits/basic.hpp
View file @
2f05c417
...
...
@@ -44,13 +44,16 @@ namespace AMDiS
// introduce some shortcuts for boost::mpl
// ---------------------------------------
using
boost
::
mpl
::
bool_
;
using
boost
::
mpl
::
true_
;
using
boost
::
mpl
::
false_
;
using
boost
::
mpl
::
and_
;
using
boost
::
mpl
::
or_
;
using
boost
::
enable_if
;
using
boost
::
enable_if_c
;
using
boost
::
disable_if
;
using
boost
::
disable_if_c
;
namespace
traits
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment