Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CTA-LAPP
PHOENIX_LIBS
PhoenixPerformance
Commits
7f9259bd
Commit
7f9259bd
authored
Jan 26, 2021
by
Pierre Aubert
Browse files
Fix intrinsics version of Gray Scott
parent
46c80770
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
14 deletions
+24
-14
src/cpp20/Sequential/GrayScott/GrayScottDataFormat/temporary_alloc.cpp
...uential/GrayScott/GrayScottDataFormat/temporary_alloc.cpp
+1
-1
src/cpp20/Sequential/GrayScott/Intrinsics/intrinsics_propagation.cpp
...equential/GrayScott/Intrinsics/intrinsics_propagation.cpp
+2
-2
src/cpp20/Sequential/GrayScott/Program/main_intrinsics.cpp
src/cpp20/Sequential/GrayScott/Program/main_intrinsics.cpp
+21
-11
No files found.
src/cpp20/Sequential/GrayScott/GrayScottDataFormat/temporary_alloc.cpp
View file @
7f9259bd
...
...
@@ -32,7 +32,7 @@ void allocate_temporary(float *& tmpU1, float *& tmpU2, float *& tmpV1, float *&
tmpInV
.
fill
(
0.0
f
);
tmpOutV
.
fill
(
0.0
f
);
size_t
frac
(
9
lu
),
numBegin
(
4
lu
),
numEnd
(
5
lu
),
rowShift
(
-
25
lu
);
size_t
frac
(
16
lu
),
numBegin
(
7
lu
),
numEnd
(
8
lu
),
rowShift
(
-
4
lu
);
for
(
size_t
i
(
rowShift
+
(
numBegin
*
nbRow
)
/
frac
);
i
<
rowShift
+
(
numEnd
*
nbRow
)
/
frac
;
++
i
){
for
(
size_t
j
((
numBegin
*
nbCol
)
/
frac
);
j
<
(
numEnd
*
nbCol
)
/
frac
;
++
j
){
tmpInU
.
setValue
(
i
,
j
,
0.0
f
);
...
...
src/cpp20/Sequential/GrayScott/Intrinsics/intrinsics_propagation.cpp
View file @
7f9259bd
...
...
@@ -72,8 +72,8 @@ void grayscott_propagation(float * outMatVecU, float * outMatVecV, const float *
PRegVecf
vecKLUminU
(
plib_sub_ps
(
vecKLU
,
vecU
));
PRegVecf
vecKLVminV
(
plib_sub_ps
(
vecKLV
,
vecV
));
PRegVecf
vecKLUminUdMultDeltaSquare
(
plib_
sub
_ps
(
vecKLUminU
,
vecDeltaSquare
));
PRegVecf
vecKLVminVdMultDeltaSquare
(
plib_
sub
_ps
(
vecKLVminV
,
vecDeltaSquare
));
PRegVecf
vecKLUminUdMultDeltaSquare
(
plib_
mul
_ps
(
vecKLUminU
,
vecDeltaSquare
));
PRegVecf
vecKLVminVdMultDeltaSquare
(
plib_
mul
_ps
(
vecKLVminV
,
vecDeltaSquare
));
vecFullU
=
plib_add_ps
(
vecFullU
,
vecKLUminUdMultDeltaSquare
);
vecFullV
=
plib_add_ps
(
vecFullV
,
vecKLVminVdMultDeltaSquare
);
...
...
src/cpp20/Sequential/GrayScott/Program/main_intrinsics.cpp
View file @
7f9259bd
...
...
@@ -61,6 +61,7 @@ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraSte
//TODO : create an other MatrixHdf5 to store the vectorial matrices and see what's going on
PTensor
<
float
>
tmpInU
,
tmpInV
,
tmpOutU
,
tmpOutV
;
float
*
tmpU1
=
NULL
,
*
tmpU2
=
NULL
,
*
tmpV1
=
NULL
,
*
tmpV2
=
NULL
;
allocate_temporary
(
tmpU1
,
tmpU2
,
tmpV1
,
tmpV2
,
tmpInU
,
tmpInV
,
tmpOutU
,
tmpOutV
,
nbRow
,
nbCol
);
...
...
@@ -85,14 +86,20 @@ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraSte
PTensor
<
float
>
vecMatDeltaSquare
(
AllocMode
::
ALIGNED
,
nbStencilRow
,
nbStencilCol
*
PLIB_VECTOR_SIZE_FLOAT
);
reshuffle_broadcastTensor
(
vecMatDeltaSquare
.
getData
(),
matDeltaSquare
,
nbStencilRow
,
nbStencilCol
,
0lu
,
PLIB_VECTOR_SIZE_FLOAT
);
tmp
U1
=
tmpVecInU
.
getData
();
tmp
U2
=
tmpVecOutU
.
getData
();
tmp
V1
=
tmpVecInV
.
getData
();
tmp
V2
=
tmpVecOutV
.
getData
();
float
*
tmpVec
U1
=
tmpVecInU
.
getData
();
float
*
tmpVec
U2
=
tmpVecOutU
.
getData
();
float
*
tmpVec
V1
=
tmpVecInV
.
getData
();
float
*
tmpVec
V2
=
tmpVecOutV
.
getData
();
float
*
ptrVecMatStencil
=
vecMatDeltaSquare
.
getData
();
size_t
nbVecRow
(
tmpVecInV
.
getFullNbRow
()),
nbVecCol
(
tmpVecInV
.
getNbCol
());
MatrixHdf5
fullVecMat
;
fullVecMat
.
setAllDim
(
nbVecCol
,
nbVecRow
);
fullVecMat
.
resize
(
nbImage
);
//TODO : create an other MatrixHdf5 to store the vectorial matrices and see what's going on
PTensor
<
float
>
tmpScalOutV
(
AllocMode
::
ALIGNED
);
ProgressTime
progress
(
nbImage
);
...
...
@@ -100,32 +107,35 @@ bool simulateImage(size_t nbRow, size_t nbCol, size_t nbImage, size_t nbExtraSte
for
(
size_t
i
(
0lu
);
i
<
nbImage
;
++
i
){
progress
.
print
();
for
(
size_t
j
(
0lu
);
j
<
nbExtraStep
;
++
j
){
grayscott_propagation
(
tmpU2
,
tmpV2
,
tmpU1
,
tmpV1
,
nbVecRow
,
nbVecCol
,
grayscott_propagation
(
tmp
Vec
U2
,
tmpV
ecV
2
,
tmp
Vec
U1
,
tmpV
ecV
1
,
nbVecRow
,
nbVecCol
,
ptrVecMatStencil
,
nbStencilRow
,
nbStencilCol
,
diffudionRateU
,
diffusionRateV
,
feedRate
,
killRate
,
dt
);
//Let's update the dupplicated values
reshuffle_updateDupplicateVecNeighbour
(
tmpU2
,
nbVecRow
,
nbVecCol
,
PLIB_VECTOR_SIZE_FLOAT
);
reshuffle_updateDupplicateVecNeighbour
(
tmpV2
,
nbVecRow
,
nbVecCol
,
PLIB_VECTOR_SIZE_FLOAT
);
reshuffle_updateDupplicateVecNeighbour
(
tmp
Vec
U2
,
nbVecRow
,
nbVecCol
,
PLIB_VECTOR_SIZE_FLOAT
);
reshuffle_updateDupplicateVecNeighbour
(
tmpV
ecV
2
,
nbVecRow
,
nbVecCol
,
PLIB_VECTOR_SIZE_FLOAT
);
///Let's swap the pointer
swapValue
(
tmpU1
,
tmpU2
);
swapValue
(
tmpV1
,
tmpV2
);
swapValue
(
tmp
Vec
U1
,
tmp
Vec
U2
);
swapValue
(
tmpV
ecV
1
,
tmpV
ecV
2
);
}
if
(
tmpV1
!=
tmpVecOutV
.
getData
()){
if
(
tmpV
ecV
1
!=
tmpVecOutV
.
getData
()){
tmpScalOutV
.
fromVecToScalNeigbhour
(
tmpVecOutV
);
fullVecMat
.
setRow
(
i
,
tmpVecOutV
.
getData
());
}
else
{
tmpScalOutV
.
fromVecToScalNeigbhour
(
tmpVecInV
);
//The pointers were swaped
fullVecMat
.
setRow
(
i
,
tmpVecInV
.
getData
());
}
fullMat
.
setRow
(
i
,
tmpScalOutV
.
getData
());
// fullMat.setRow(i, tmpV1);
// fullMat.setRow(i, tmpV
ecV
1);
// fullMat.setRow(i, tmpV2);
}
progress
.
finish
();
std
::
cerr
<<
"Done"
<<
std
::
endl
;
//Let's save the output file
fullMat
.
write
(
outputFile
);
fullVecMat
.
write
(
"./output_vec.h5"
);
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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