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
Thomas White
pinkindexer
Commits
6efb9622
Commit
6efb9622
authored
Mar 06, 2019
by
Yaroslav Gevorkov
Browse files
add thread count to openMP
parent
f1827cdd
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
6efb9622
...
...
@@ -50,6 +50,7 @@ endif(PINKINDEXER_BUILD_EXECUTABLE)
if
(
OpenMP_CXX_FOUND
)
target_link_libraries
(
pinkIndexer PUBLIC OpenMP::OpenMP_CXX
)
add_definitions
(
-DOPENMP_AVAILABLE
)
endif
(
OpenMP_CXX_FOUND
)
if
(
EIGEN3_FOUND
)
...
...
include/PinkIndexer.h
View file @
6efb9622
...
...
@@ -58,7 +58,7 @@ namespace pinkIndexer
void
reducePeakCount
(
Eigen
::
Matrix3Xf
&
ucsDirections
,
Eigen
::
Array2Xf
&
ucsBorderNorms
,
Eigen
::
RowVectorXf
&
intensities
,
const
Eigen
::
Matrix2Xf
&
detectorPeaks_m
);
void
refine
(
Lattice
&
indexedLattice
,
Eigen
::
Vector2f
&
centerShift
,
const
Eigen
::
Matrix3Xf
&
ucsDirections
,
const
Eigen
::
Array2Xf
&
ucsBorderNorms
,
const
Eigen
::
Matrix2Xf
&
detectorPeaks_m
);
const
Eigen
::
Matrix2Xf
&
detectorPeaks_m
,
int
threadCount
);
float
getAngleResolution
();
int
getConsideredPeaksCount
();
...
...
src/PinkIndexer.cpp
View file @
6efb9622
...
...
@@ -4,6 +4,10 @@
#include
<fstream>
#include
<numeric>
#ifdef OPENMP_AVAILABLE
#include
<omp.h>
#endif
using
namespace
std
;
using
namespace
Eigen
;
...
...
@@ -72,7 +76,7 @@ namespace pinkIndexer
Matrix3f
bestBasis
=
bestRotation
*
sampleLattice
.
getBasis
();
indexedLattice
=
Lattice
(
bestBasis
);
refine
(
indexedLattice
,
centerShift
,
ucsDirections
,
ucsBorderNorms
,
detectorPeaks_m
);
refine
(
indexedLattice
,
centerShift
,
ucsDirections
,
ucsBorderNorms
,
detectorPeaks_m
,
threadCount
);
indexedLattice
.
minimize
();
indexedLattice
.
reorder
(
sampleLattice
);
...
...
@@ -83,7 +87,7 @@ namespace pinkIndexer
}
void
PinkIndexer
::
refine
(
Lattice
&
indexedLattice
,
Vector2f
&
centerShift
,
const
Matrix3Xf
&
ucsDirections
,
const
Array2Xf
&
ucsBorderNorms
,
const
Matrix2Xf
&
detectorPeaks_m
)
const
Matrix2Xf
&
detectorPeaks_m
,
int
threadCount
)
{
centerShift
.
setZero
();
...
...
@@ -120,6 +124,10 @@ namespace pinkIndexer
float
maxRelativeDeviation
=
0.0125
;
Array
<
float
,
1
,
3
>
columnDeviationNorms
=
indexedLattice
.
getBasis
().
colwise
().
norm
()
*
maxRelativeDeviation
;
#ifdef OPENMP_AVAILABLE
omp_set_num_threads
(
threadCount
);
#endif
#pragma omp parallel for
for
(
int
i
=
0
;
i
<
refinementTries
;
++
i
)
{
...
...
@@ -174,6 +182,10 @@ namespace pinkIndexer
float
maxRelativeDeviation
=
0.0125
;
Array
<
float
,
1
,
3
>
columnDeviationNorms
=
indexedLattice
.
getBasis
().
colwise
().
norm
()
*
maxRelativeDeviation
;
#ifdef OPENMP_AVAILABLE
omp_set_num_threads
(
threadCount
);
#endif
#pragma omp parallel for
for
(
int
i
=
0
;
i
<
refinementTries
;
++
i
)
{
...
...
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