Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BioEM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
MPIBP-Hummer
BioEM
Commits
05e7d589
Commit
05e7d589
authored
11 years ago
by
David Rohr
Browse files
Options
Downloads
Patches
Plain Diff
fix GPUWORKLOAD parameter
parent
02123bb1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
bioem_cuda.cu
+25
-7
25 additions, 7 deletions
bioem_cuda.cu
include/bioem.h
+1
-0
1 addition, 0 deletions
include/bioem.h
include/bioem_cuda_internal.h
+2
-0
2 additions, 0 deletions
include/bioem_cuda_internal.h
include/map.h
+2
-1
2 additions, 1 deletion
include/map.h
map.cpp
+28
-14
28 additions, 14 deletions
map.cpp
with
58 additions
and
22 deletions
bioem_cuda.cu
+
25
−
7
View file @
05e7d589
...
...
@@ -305,9 +305,7 @@ int bioem_cuda::deviceInit()
gpumap
->
sum_RefMap
=
sum
;
gpumap
->
sumsquare_RefMap
=
sumsquare
;
pProb_device
=
pProb
;
checkCudaErrors
(
cudaMalloc
(
&
pProb_device
.
ptr
,
pProb_device
.
get_size
(
RefMap
.
ntotRefMap
,
param
.
nTotGridAngles
)));
pProb_device
.
set_pointers
();
checkCudaErrors
(
cudaMalloc
(
&
pProb_memory
,
pProb_device
.
get_size
(
RefMap
.
ntotRefMap
,
param
.
nTotGridAngles
)));
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
checkCudaErrors
(
cudaStreamCreate
(
&
cudaStream
[
i
]));
...
...
@@ -342,7 +340,7 @@ int bioem_cuda::deviceExit()
if
(
deviceInitialized
==
0
)
return
(
0
);
cudaFree
(
pProb_
device
.
ptr
);
cudaFree
(
pProb_
memory
);
cudaFree
(
sum
);
cudaFree
(
sumsquare
);
for
(
int
i
=
0
;
i
<
2
;
i
++
)
...
...
@@ -383,9 +381,23 @@ int bioem_cuda::deviceExit()
int
bioem_cuda
::
deviceStartRun
()
{
maxRef
=
GPUWorkload
>=
100
?
RefMap
.
ntotRefMap
:
((
size_t
)
RefMap
.
ntotRefMap
*
(
size_t
)
GPUWorkload
/
100
);
if
(
GPUWorkload
>=
100
)
{
maxRef
=
RefMap
.
ntotRefMap
;
pProb_host
=
&
pProb
;
}
else
{
maxRef
=
(
size_t
)
RefMap
.
ntotRefMap
*
(
size_t
)
GPUWorkload
/
100
;
pProb_host
=
new
bioem_Probability
;
pProb_host
->
init
(
maxRef
,
param
.
nTotGridAngles
,
*
this
);
pProb_host
->
copyFrom
(
&
pProb
,
*
this
);
}
cudaMemcpyAsync
(
pProb_device
.
ptr
,
pProb
.
ptr
,
pProb
.
get_size
(
RefMap
.
ntotRefMap
,
param
.
nTotGridAngles
),
cudaMemcpyHostToDevice
,
cudaStream
[
0
]);
pProb_device
=
*
pProb_host
;
pProb_device
.
ptr
=
pProb_memory
;
pProb_device
.
set_pointers
();
checkCudaErrors
(
cudaMemcpyAsync
(
pProb_device
.
ptr
,
pProb_host
->
ptr
,
pProb_host
->
get_size
(
maxRef
,
param
.
nTotGridAngles
),
cudaMemcpyHostToDevice
,
cudaStream
[
0
]));
if
(
FFTAlgo
)
{
...
...
@@ -420,7 +432,7 @@ int bioem_cuda::deviceStartRun()
int
bioem_cuda
::
deviceFinishRun
()
{
if
(
GPUAsync
)
cudaStreamSynchronize
(
cudaStream
[
0
]);
cudaMemcpyAsync
(
pProb
.
ptr
,
pProb_device
.
ptr
,
pProb
.
get_size
(
Ref
Map
.
ntotRefMap
,
param
.
nTotGridAngles
),
cudaMemcpyDeviceToHost
,
cudaStream
[
0
]);
checkCudaErrors
(
cudaMemcpyAsync
(
pProb
_host
->
ptr
,
pProb_device
.
ptr
,
pProb
_host
->
get_size
(
max
Ref
,
param
.
nTotGridAngles
),
cudaMemcpyDeviceToHost
,
cudaStream
[
0
])
)
;
if
(
FFTAlgo
)
{
...
...
@@ -434,6 +446,12 @@ int bioem_cuda::deviceFinishRun()
if
(
!
GPUDualStream
)
break
;
}
}
cudaThreadSynchronize
();
if
(
GPUWorkload
<
100
)
{
pProb
.
copyFrom
(
pProb_host
,
*
this
);
delete
[]
pProb_host
;
}
return
(
0
);
}
...
...
This diff is collapsed.
Click to expand it.
include/bioem.h
+
1
−
0
View file @
05e7d589
...
...
@@ -13,6 +13,7 @@
class
bioem
{
friend
class
bioem_RefMap
;
friend
class
bioem_Probability
;
public:
bioem
();
...
...
This diff is collapsed.
Click to expand it.
include/bioem_cuda_internal.h
+
2
−
0
View file @
05e7d589
...
...
@@ -34,7 +34,9 @@ protected:
cudaEvent_t
cudaFFTEvent
[
2
];
bioem_RefMap_Mod
*
pRefMap_device_Mod
;
bioem_RefMap
*
gpumap
;
bioem_Probability
*
pProb_host
;
bioem_Probability
pProb_device
;
void
*
pProb_memory
;
myfloat_t
*
pConvMap_device
[
2
];
mycomplex_t
*
pRefMapsFFT
;
...
...
This diff is collapsed.
Click to expand it.
include/map.h
+
2
−
1
View file @
05e7d589
...
...
@@ -107,12 +107,13 @@ public:
bioem_Probability_map
*
ptr_map
;
bioem_Probability_angle
*
ptr_angle
;
size_t
get_size
(
size_t
maps
,
size_t
angles
)
static
size_t
get_size
(
size_t
maps
,
size_t
angles
)
{
return
(
maps
*
(
angles
*
sizeof
(
bioem_Probability_angle
)
+
sizeof
(
bioem_Probability_map
)));
}
void
init
(
size_t
maps
,
size_t
angles
,
bioem
&
bio
);
void
copyFrom
(
bioem_Probability
*
from
,
bioem
&
bio
);
void
set_pointers
()
{
...
...
This diff is collapsed.
Click to expand it.
map.cpp
+
28
−
14
View file @
05e7d589
...
...
@@ -280,6 +280,20 @@ void bioem_Probability::init(size_t maps, size_t angles, bioem& bio)
set_pointers
();
}
void
bioem_Probability
::
copyFrom
(
bioem_Probability
*
from
,
bioem
&
bio
)
{
bioem_Probability_map
&
pProbMap
=
getProbMap
(
0
);
bioem_Probability_map
&
pProbMapFrom
=
from
->
getProbMap
(
0
);
memcpy
(
&
pProbMap
,
&
pProbMapFrom
,
from
->
nMaps
*
sizeof
(
bioem_Probability_map
));
for
(
int
iOrient
=
0
;
iOrient
<
bio
.
param
.
nTotGridAngles
;
iOrient
++
)
{
bioem_Probability_angle
&
pProbAngle
=
getProbAngle
(
0
,
iOrient
);
bioem_Probability_angle
&
pProbAngleFrom
=
from
->
getProbAngle
(
0
,
iOrient
);
memcpy
(
&
pProbAngle
,
&
pProbAngleFrom
,
from
->
nMaps
*
sizeof
(
bioem_Probability_angle
));
}
}
int
bioem_RefMap
::
read_MRC
(
const
char
*
filename
,
bioem_param
&
param
)
{
myfloat_t
st
,
st2
;
...
...
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