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
SWIFT
SWIFTsim
Commits
8060a976
Commit
8060a976
authored
Dec 12, 2012
by
Pedro Gonnet
Browse files
add vectorization for kernels.
Former-commit-id: ca1107fd3c329c87dd061f6cfce1d0a1c98d918b
parent
3d84436f
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/test.c
View file @
8060a976
...
...
@@ -615,11 +615,53 @@ void kernel_dump ( int N ) {
int
k
;
float
x
,
w
,
dw_dx
;
float
x4
[
4
]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
w4
[
4
],
dw_dx4
[
4
]
__attribute__
((
aligned
(
16
)));
for
(
k
=
0
;
k
<=
N
;
k
++
)
{
x
=
((
float
)
k
)
/
N
*
kernel_igamma
;
x4
[
3
]
=
x4
[
2
];
x4
[
2
]
=
x4
[
1
];
x4
[
1
]
=
x4
[
0
];
x4
[
0
]
=
x
;
kernel_deval
(
x
,
&
w
,
&
dw_dx
);
printf
(
" %e %e %e
\n
"
,
x
,
w
,
dw_dx
);
kernel_deval_vec
(
(
vector
*
)
x4
,
(
vector
*
)
w4
,
(
vector
*
)
dw_dx4
);
printf
(
" %e %e %e %e %e %e %e
\n
"
,
x
,
w
,
dw_dx
,
w4
[
0
]
,
w4
[
1
]
,
w4
[
2
]
,
w4
[
3
]
);
}
}
/**
* @brief Test the density function by dumping it for two random parts.
*
* @param N number of intervals in [0,1].
*/
void
density_dump
(
int
N
)
{
int
k
;
float
r2
[
4
]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
hi
[
4
],
hj
[
4
];
struct
part
*
pi
[
4
],
*
pj
[
4
],
Pi
[
4
],
Pj
[
4
];
/* Init the interaction parameters. */
for
(
k
=
0
;
k
<
4
;
k
++
)
{
Pi
[
k
].
mass
=
1
.
0
f
;
Pi
[
k
].
rho
=
0
.
0
f
;
Pi
[
k
].
wcount
=
0
.
0
f
;
Pj
[
k
].
mass
=
1
.
0
f
;
Pj
[
k
].
rho
=
0
.
0
f
;
Pj
[
k
].
wcount
=
0
.
0
f
;
hi
[
k
]
=
1
.
0
;
hj
[
k
]
=
1
.
0
;
pi
[
k
]
=
&
Pi
[
k
];
pj
[
k
]
=
&
Pj
[
k
];
}
for
(
k
=
0
;
k
<=
N
;
k
++
)
{
r2
[
3
]
=
r2
[
2
];
r2
[
2
]
=
r2
[
1
];
r2
[
1
]
=
r2
[
0
];
r2
[
0
]
=
((
float
)
k
)
/
N
;
Pi
[
0
].
wcount
=
0
;
Pj
[
0
].
wcount
=
0
;
runner_iact_density
(
r2
[
0
]
,
NULL
,
hi
[
0
]
,
hj
[
0
]
,
&
Pi
[
0
]
,
&
Pj
[
0
]
);
printf
(
" %e %e %e"
,
r2
[
0
]
,
Pi
[
0
].
wcount
,
Pj
[
0
].
wcount
);
Pi
[
0
].
wcount
=
0
;
Pj
[
0
].
wcount
=
0
;
Pi
[
1
].
wcount
=
0
;
Pj
[
1
].
wcount
=
0
;
Pi
[
2
].
wcount
=
0
;
Pj
[
2
].
wcount
=
0
;
Pi
[
3
].
wcount
=
0
;
Pj
[
3
].
wcount
=
0
;
runner_iact_vec_density
(
r2
,
NULL
,
hi
,
hj
,
pi
,
pj
);
printf
(
" %e %e %e %e
\n
"
,
Pi
[
0
].
wcount
,
Pi
[
1
].
wcount
,
Pi
[
2
].
wcount
,
Pi
[
3
].
wcount
);
}
}
...
...
@@ -820,6 +862,7 @@ int main ( int argc , char *argv[] ) {
/* Dump the kernel to make sure its ok. */
// kernel_dump( 100 );
// density_dump( 100 );
/* Get the brute-force number of pairs. */
// pairs_n2( dim , parts , N , periodic );
...
...
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