Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graintracking
DCT
Commits
18fd4f14
Commit
18fd4f14
authored
12 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
Astra: updated benchmarks against new cell interface
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
387b7b25
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
zUtil_DataStructures/GtAstraBenchmarks.m
+286
-28
286 additions, 28 deletions
zUtil_DataStructures/GtAstraBenchmarks.m
zUtil_DataStructures/GtBenchmarks.m
+2
-1
2 additions, 1 deletion
zUtil_DataStructures/GtBenchmarks.m
with
288 additions
and
29 deletions
zUtil_DataStructures/GtAstraBenchmarks.m
+
286
−
28
View file @
18fd4f14
classdef
GtAstraBenchmarks
<
GtBenchmarks
methods
(
Access
=
public
,
Static
)
function
benchmark3Dset
(
numIters
,
sirtDetectImages
)
if
(
~
exist
(
'numIters'
,
'var'
))
numIters
=
20
;
end
if
(
~
exist
(
'sirtDetectImages'
,
'var'
))
sirtDetectImages
=
rand
(
1e2
,
2e2
,
3e2
);
end
proj
=
[];
proj
.
stack
=
sirtDetectImages
;
proj
.
num_cols
=
size
(
sirtDetectImages
,
1
);
proj
.
num_rows
=
size
(
sirtDetectImages
,
3
);
proj
.
geom
=
ones
(
size
(
sirtDetectImages
,
2
),
12
);
proj_geom
=
astra_create_proj_geom
(
'parallel3d_vec'
,
proj
.
num_rows
,
proj
.
num_cols
,
proj
.
geom
);
%%% SINO
function
benchmark3Dcreate
(
numIters
,
sirtDetectImages
)
[
proj
,
proj_geom
]
=
GtAstraBenchmarks
.
createProjAndGeom
(
sirtDetectImages
);
bytes
=
GtBenchmarks
.
getSizeVariable
(
sirtDetectImages
);
GtBenchmarks
.
printHeader
(
'
Set
Mex Data 3D'
,
bytes
)
GtBenchmarks
.
printHeader
(
'
Create
Mex Data 3D'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
tic
();
...
...
@@ -26,7 +16,28 @@ classdef GtAstraBenchmarks < GtBenchmarks
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
create
''
,
''
-proj3d
''
)'
,
toc
()/
numIters
,
bytes
);
% Let's assume 'get' is correct!
proj_id
=
astra_mex_data3d
(
'create'
,
'-proj3d'
,
proj_geom
,
proj
.
stack
);
proj_id
=
astra_mex_data3d
(
'create'
,
'-proj3d'
,
proj_geom
,
proj
.
stack
);
copied
=
astra_mex_data3d
(
'get'
,
proj_id
);
astra_mex_data3d
(
'delete'
,
proj_id
);
GtBenchmarks
.
verifyError
(
sirtDetectImages
,
copied
);
end
function
benchmark3Dstore
(
numIters
,
sirtDetectImages
)
[
proj
,
proj_geom
]
=
GtAstraBenchmarks
.
createProjAndGeom
(
sirtDetectImages
);
bytes
=
GtBenchmarks
.
getSizeVariable
(
sirtDetectImages
);
GtBenchmarks
.
printHeader
(
'Store Mex Data 3D'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
proj_id
=
astra_mex_data3d
(
'create'
,
'-proj3d'
,
proj_geom
,
proj
.
stack
);
tic
();
for
ii
=
1
:
numIters
astra_mex_data3d
(
'store'
,
proj_id
,
proj
.
stack
);
end
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
store
''
,
''
-proj3d
''
)'
,
toc
()/
numIters
,
bytes
);
% Let's assume 'get' is correct!
copied
=
astra_mex_data3d
(
'get'
,
proj_id
);
astra_mex_data3d
(
'delete'
,
proj_id
);
...
...
@@ -34,23 +45,72 @@ classdef GtAstraBenchmarks < GtBenchmarks
end
function
benchmark3Dget
(
numIters
,
sirtDetectImages
)
if
(
~
exist
(
'numIters'
,
'var'
))
numIters
=
20
;
[
proj
,
proj_geom
]
=
GtAstraBenchmarks
.
createProjAndGeom
(
sirtDetectImages
);
bytes
=
GtBenchmarks
.
getSizeVariable
(
sirtDetectImages
);
GtBenchmarks
.
printHeader
(
'Get Mex Data 3D'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
proj_id
=
astra_mex_data3d
(
'create'
,
'-proj3d'
,
proj_geom
,
proj
.
stack
);
tic
();
for
ii
=
1
:
numIters
proj
=
astra_mex_data3d
(
'get'
,
proj_id
);
end
if
(
~
exist
(
'sirtDetectImages'
,
'var'
))
sirtDetectImages
=
rand
(
1e2
,
2e2
,
3e2
);
astra_mex_data3d
(
'delete'
,
proj_id
);
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
get
''
, proj_id)'
,
toc
()/
numIters
,
bytes
);
end
%%% VOL
function
benchmarkVolCreate
(
numIters
,
sirtDetectImages
)
vol_geom
=
GtAstraBenchmarks
.
createVolAndGeom
(
sirtDetectImages
);
bytes
=
GtBenchmarks
.
getSizeVariable
(
sirtDetectImages
);
GtBenchmarks
.
printHeader
(
'Create Mex Data 3D'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
tic
();
for
ii
=
1
:
numIters
proj_id
=
astra_mex_data3d
(
'create'
,
'-vol'
,
vol_geom
,
sirtDetectImages
);
astra_mex_data3d
(
'delete'
,
proj_id
);
end
proj
=
[];
proj
.
stack
=
sirtDetectImages
;
proj
.
num_cols
=
size
(
sirtDetectImages
,
1
);
proj
.
num_rows
=
size
(
sirtDetectImages
,
3
);
proj
.
geom
=
ones
(
size
(
sirtDetectImages
,
2
),
12
);
proj_geom
=
astra_create_proj_geom
(
'parallel3d_vec'
,
proj
.
num_rows
,
proj
.
num_cols
,
proj
.
geom
);
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
create
''
,
''
-vol
''
)'
,
toc
()/
numIters
,
bytes
);
% Let's assume 'get' is correct!
proj_id
=
astra_mex_data3d
(
'create'
,
'-vol'
,
vol_geom
,
sirtDetectImages
);
copied
=
astra_mex_data3d
(
'get'
,
proj_id
);
astra_mex_data3d
(
'delete'
,
proj_id
);
GtBenchmarks
.
verifyError
(
sirtDetectImages
,
copied
);
end
function
benchmarkVolStore
(
numIters
,
sirtDetectImages
)
vol_geom
=
GtAstraBenchmarks
.
createVolAndGeom
(
sirtDetectImages
);
bytes
=
GtBenchmarks
.
getSizeVariable
(
sirtDetectImages
);
GtBenchmarks
.
printHeader
(
'Store Mex Data 3D'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
proj_id
=
astra_mex_data3d
(
'create'
,
'-vol'
,
vol_geom
);
tic
();
for
ii
=
1
:
numIters
astra_mex_data3d
(
'store'
,
proj_id
,
sirtDetectImages
);
end
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
store
''
,
''
-vol
''
)'
,
toc
()/
numIters
,
bytes
);
% Let's assume 'get' is correct!
copied
=
astra_mex_data3d
(
'get'
,
proj_id
);
astra_mex_data3d
(
'delete'
,
proj_id
);
GtBenchmarks
.
verifyError
(
sirtDetectImages
,
copied
);
end
function
benchmarkVolGet
(
numIters
,
sirtDetectImages
)
vol_geom
=
GtAstraBenchmarks
.
createVolAndGeom
(
sirtDetectImages
);
bytes
=
GtBenchmarks
.
getSizeVariable
(
sirtDetectImages
);
GtBenchmarks
.
printHeader
(
'Get Mex Data 3D'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
proj_id
=
astra_mex_data3d
(
'create'
,
'-
proj3d'
,
proj_geom
,
proj
.
stack
);
proj_id
=
astra_mex_data3d
(
'create'
,
'-
vol'
,
vol_geom
,
sirtDetectImages
);
tic
();
for
ii
=
1
:
numIters
...
...
@@ -60,11 +120,209 @@ classdef GtAstraBenchmarks < GtBenchmarks
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
get
''
, proj_id)'
,
toc
()/
numIters
,
bytes
);
end
%%% CELL SINO
function
benchmarkCellCreate
(
numIters
,
detectImages
,
numCells
)
proj
=
cell
(
1
,
numCells
);
proj_geom
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
[
proj
{
n
},
proj_geom
{
n
}]
=
GtAstraBenchmarks
.
createProjAndGeom
(
detectImages
);
end
proj_stack
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
proj_stack
{
n
}
=
proj
{
n
}
.
stack
;
end
bytes
=
numCells
*
GtBenchmarks
.
getSizeVariable
(
detectImages
);
GtBenchmarks
.
printHeader
(
'Create Mex Data Cell'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
tic
();
for
ii
=
1
:
numIters
proj_id
=
astra_mex_data3d
(
'create'
,
'-proj3d'
,
proj_geom
,
proj_stack
);
astra_mex_data3d
(
'delete'
,
proj_id
{:});
end
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
create
''
,
''
-proj3d
''
)'
,
toc
()/
numIters
,
bytes
);
% Let's assume 'get' is correct!
proj_id
=
astra_mex_data3d
(
'create'
,
'-proj3d'
,
proj_geom
,
proj_stack
);
copied
=
astra_mex_data3d
(
'get'
,
proj_id
);
astra_mex_data3d
(
'delete'
,
proj_id
{:});
GtBenchmarks
.
verifyError
(
proj_stack
,
copied
);
end
function
benchmarkCellStore
(
numIters
,
detectImages
,
numCells
)
proj
=
cell
(
1
,
numCells
);
proj_geom
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
[
proj
{
n
},
proj_geom
{
n
}]
=
GtAstraBenchmarks
.
createProjAndGeom
(
detectImages
);
end
proj_stack
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
proj_stack
{
n
}
=
proj
{
n
}
.
stack
;
end
bytes
=
numCells
*
GtBenchmarks
.
getSizeVariable
(
detectImages
);
GtBenchmarks
.
printHeader
(
'Store Mex Data Cell'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
proj_id
=
astra_mex_data3d
(
'create'
,
'-proj3d'
,
proj_geom
,
proj_stack
);
tic
();
for
ii
=
1
:
numIters
astra_mex_data3d
(
'store'
,
proj_id
,
proj_stack
);
end
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
store
''
,
''
-proj3d
''
)'
,
toc
()/
numIters
,
bytes
);
% Let's assume 'get' is correct!
copied
=
astra_mex_data3d
(
'get'
,
proj_id
);
astra_mex_data3d
(
'delete'
,
proj_id
{:});
GtBenchmarks
.
verifyError
(
proj_stack
,
copied
);
end
function
benchmarkCellGet
(
numIters
,
detectImages
,
numCells
)
proj
=
cell
(
1
,
numCells
);
proj_geom
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
[
proj
{
n
},
proj_geom
{
n
}]
=
GtAstraBenchmarks
.
createProjAndGeom
(
detectImages
);
end
proj_stack
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
proj_stack
{
n
}
=
proj
{
n
}
.
stack
;
end
bytes
=
numCells
*
GtBenchmarks
.
getSizeVariable
(
detectImages
);
GtBenchmarks
.
printHeader
(
'Get Mex Data Cell'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
proj_id
=
astra_mex_data3d
(
'create'
,
'-proj3d'
,
proj_geom
,
proj_stack
);
tic
();
for
ii
=
1
:
numIters
proj
=
astra_mex_data3d
(
'get'
,
proj_id
);
end
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
get
''
, proj_id)'
,
toc
()/
numIters
,
bytes
);
astra_mex_data3d
(
'delete'
,
proj_id
{:});
end
%%% CELL VOL
function
benchmarkCellVolCreate
(
numIters
,
detectImages
,
numCells
)
vol_geom
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
vol_geom
{
n
}
=
GtAstraBenchmarks
.
createVolAndGeom
(
detectImages
);
end
vol_stack
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
vol_stack
{
n
}
=
detectImages
;
end
bytes
=
numCells
*
GtBenchmarks
.
getSizeVariable
(
detectImages
);
GtBenchmarks
.
printHeader
(
'Create Mex Data Cell'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
tic
();
for
ii
=
1
:
numIters
proj_id
=
astra_mex_data3d
(
'create'
,
'-vol'
,
vol_geom
,
vol_stack
);
astra_mex_data3d
(
'delete'
,
proj_id
{:});
end
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
create
''
,
''
-vol
''
)'
,
toc
()/
numIters
,
bytes
);
% Let's assume 'get' is correct!
proj_id
=
astra_mex_data3d
(
'create'
,
'-vol'
,
vol_geom
,
vol_stack
);
copied
=
astra_mex_data3d
(
'get'
,
proj_id
);
astra_mex_data3d
(
'delete'
,
proj_id
{:});
GtBenchmarks
.
verifyError
(
vol_stack
,
copied
);
end
function
benchmarkCellVolStore
(
numIters
,
detectImages
,
numCells
)
vol_geom
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
vol_geom
{
n
}
=
GtAstraBenchmarks
.
createVolAndGeom
(
detectImages
);
end
vol_stack
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
vol_stack
{
n
}
=
detectImages
;
end
bytes
=
numCells
*
GtBenchmarks
.
getSizeVariable
(
detectImages
);
GtBenchmarks
.
printHeader
(
'Store Mex Data Cell'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
proj_id
=
astra_mex_data3d
(
'create'
,
'-vol'
,
vol_geom
);
tic
();
for
ii
=
1
:
numIters
astra_mex_data3d
(
'store'
,
proj_id
,
vol_stack
);
end
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
store
''
,
''
-vol
''
)'
,
toc
()/
numIters
,
bytes
);
% Let's assume 'get' is correct!
copied
=
astra_mex_data3d
(
'get'
,
proj_id
);
astra_mex_data3d
(
'delete'
,
proj_id
{:});
GtBenchmarks
.
verifyError
(
vol_stack
,
copied
);
end
function
benchmarkCellVolGet
(
numIters
,
detectImages
,
numCells
)
vol_geom
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
vol_geom
{
n
}
=
GtAstraBenchmarks
.
createVolAndGeom
(
detectImages
);
end
vol_stack
=
cell
(
1
,
numCells
);
for
n
=
1
:
numCells
vol_stack
{
n
}
=
detectImages
;
end
bytes
=
numCells
*
GtBenchmarks
.
getSizeVariable
(
detectImages
);
GtBenchmarks
.
printHeader
(
'Get Mex Data Cell'
,
bytes
)
fprintf
(
' - Doing %d iterations: '
,
numIters
)
proj_id
=
astra_mex_data3d
(
'create'
,
'-vol'
,
vol_geom
,
vol_stack
);
tic
();
for
ii
=
1
:
numIters
proj
=
astra_mex_data3d
(
'get'
,
proj_id
);
end
GtBenchmarks
.
printResult
(
'astra_mex_data3d(
''
get
''
, proj_id)'
,
toc
()/
numIters
,
bytes
);
astra_mex_data3d
(
'delete'
,
proj_id
{:});
end
function
allBenchmarks
()
imgs
=
rand
(
5e2
,
5e2
,
5
e2
);
imgs
=
rand
(
1e3
,
1e3
,
1
e2
);
GtAstraBenchmarks
.
benchmark3Dset
(
5
,
imgs
)
GtAstraBenchmarks
.
benchmark3Dcreate
(
5
,
imgs
)
GtAstraBenchmarks
.
benchmark3Dstore
(
5
,
imgs
)
GtAstraBenchmarks
.
benchmark3Dget
(
5
,
imgs
)
GtAstraBenchmarks
.
benchmarkVolCreate
(
5
,
imgs
)
GtAstraBenchmarks
.
benchmarkVolStore
(
5
,
imgs
)
GtAstraBenchmarks
.
benchmarkVolGet
(
5
,
imgs
)
imgs
=
rand
(
1e3
,
1e3
,
2e1
);
GtAstraBenchmarks
.
benchmarkCellCreate
(
5
,
imgs
,
5
);
GtAstraBenchmarks
.
benchmarkCellStore
(
5
,
imgs
,
5
);
GtAstraBenchmarks
.
benchmarkCellGet
(
5
,
imgs
,
5
);
GtAstraBenchmarks
.
benchmarkCellVolCreate
(
5
,
imgs
,
5
);
GtAstraBenchmarks
.
benchmarkCellVolStore
(
5
,
imgs
,
5
);
GtAstraBenchmarks
.
benchmarkCellVolGet
(
5
,
imgs
,
5
);
% Just in case
astra_mex_data3d
(
'clear'
);
end
end
methods
(
Access
=
protected
,
Static
)
function
[
proj
,
proj_geom
]
=
createProjAndGeom
(
detectImages
)
proj
=
[];
proj
.
stack
=
detectImages
;
proj
.
num_cols
=
size
(
detectImages
,
1
);
proj
.
num_rows
=
size
(
detectImages
,
3
);
proj
.
geom
=
ones
(
size
(
detectImages
,
2
),
12
);
proj_geom
=
astra_create_proj_geom
(
'parallel3d_vec'
,
proj
.
num_rows
,
proj
.
num_cols
,
proj
.
geom
);
end
function
vol_geom
=
createVolAndGeom
(
detectImages
)
vol_geom
=
astra_create_vol_geom
(
size
(
detectImages
,
1
),
size
(
detectImages
,
2
),
size
(
detectImages
,
3
));
end
end
end
This diff is collapsed.
Click to expand it.
zUtil_DataStructures/GtBenchmarks.m
+
2
−
1
View file @
18fd4f14
...
...
@@ -19,7 +19,8 @@ classdef GtBenchmarks
function verifyError(reference, computed)
fprintf('Checking errors in computation:\n')
if (iscell(reference))
fprintf('\t%g\n', max(cellfun(@(x, y)max(max(max(abs(x - y)))), reference, computed)));
fprintf('\t%g\n', max(cellfun(@(x, y)max(max(max(abs(x - y)))), ...
reshape(reference, [numel(reference), 1]), reshape(computed, [numel(computed), 1]) )) );
elseif (isscalar(reference))
fprintf('\t%g (%g relative)\n', abs(reference - computed), abs((reference - computed)/reference) );
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment