Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Kai Karius
Fitter
Commits
a85081cc
Commit
a85081cc
authored
Dec 07, 2020
by
karius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed query loading
parent
849f588e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
25 deletions
+28
-25
FittingProtocol.cu
FittingProtocol.cu
+4
-5
PdbReader.cu
PdbReader.cu
+6
-2
PdbReader.h
PdbReader.h
+1
-1
Query.cu
Query.cu
+7
-8
Target.cu
Target.cu
+8
-8
ccl_test.cu
ccl_test.cu
+1
-1
util.h
util.h
+1
-0
No files found.
FittingProtocol.cu
View file @
a85081cc
...
...
@@ -24,8 +24,10 @@ FittingProtocol::FittingProtocol() {
}
void
FittingProtocol
::
addQueryFromPdb
(
const
char
*
file_name
){
Query
query
=
Query
::
fromPdb
(
file_name
);
queries
.
push_back
(
query
);
if
(
file_exists
(
file_name
)){
Query
query
=
Query
::
fromPdb
(
file_name
);
queries
.
push_back
(
query
);
}
}
void
FittingProtocol
::
loadTarget
(
int
gpu_index
){
...
...
@@ -74,7 +76,4 @@ void FittingProtocol::setFileTarget(const char * file_name){
if
(
file_exists
(
file_name
)){
target
=
Target
::
fromMrc
(
file_name
);
}
else
{
std
::
cout
<<
"File "
<<
file_name
<<
" is not found ..."
<<
std
::
endl
;
}
}
PdbReader.cu
View file @
a85081cc
...
...
@@ -12,8 +12,11 @@ std::map<std::string,AtomType> atom_symbol_to_type = {{"H",AtomType::H},{"C",Ato
PdbReader
::
PdbReader
(
const
char
*
path
){
std
::
ifstream
ifs
;
ifs
.
open
(
path
,
std
::
ifstream
::
in
);
_path
=
path
;
scan_file
(
ifs
);
ifs
.
close
();
}
PdbReader
::~
PdbReader
()
{}
...
...
@@ -46,8 +49,8 @@ float4 PdbReader::get_atom(std::string & line){
int
PdbReader
::
atom_coords_to_device
(
float4
*
d_coords
,
int
gpu_index
){
RecordType
type
;
std
::
string
line
;
ifs
.
clear
()
;
ifs
.
seekg
(
0
,
std
::
ios
::
beg
);
std
::
ifstream
ifs
;
ifs
.
open
(
_path
,
std
::
ifstream
::
in
);
int
c
=
0
;
assert
(
cudaSuccess
==
cudaSetDevice
(
gpu_index
));
float4
current_atom
;
...
...
@@ -60,6 +63,7 @@ int PdbReader::atom_coords_to_device(float4 * d_coords, int gpu_index){
c
++
;
}
}
ifs
.
close
();
return
error
;
}
...
...
PdbReader.h
View file @
a85081cc
...
...
@@ -369,7 +369,7 @@ private:
void
scan_file
(
std
::
ifstream
&
ifs
);
AtomType
get_atom_type
(
std
::
string
&
line
);
float4
get_atom
(
std
::
string
&
line
);
std
::
ifstream
ifs
;
const
char
*
_path
;
size_t
atom_count
{
0
};
};
#endif
/* PDBREADER_H_ */
...
...
Query.cu
View file @
a85081cc
...
...
@@ -55,25 +55,24 @@ int Query::initGpu(int gpu_index){
int
Query
::
toGpu
(
int
gpu_index
){
int
ret
=
0
;
if
(
_source_type
==
PDB
){
ret
+=
int
(
cudaSuccess
!=
cudaSetDevice
(
gpu_index
));
ret
+=
_particles
.
pdb_readers
[
0
]
->
atom_coords_to_device
(
_particles
.
d_data
,
gpu_index
);
}
return
ret
;
}
int
Query
::
loadToGpu
(
int
gpu_index
){
int
ret
=
0
;
int
error
=
0
;
if
(
!
_cpu_initiated
){
ret
+=
initCpu
();
error
+=
initCpu
();
}
assert
(
ret
!
=
0
);
assert
(
error
=
=
0
);
if
(
!
_gpu_initiated
){
ret
+=
initGpu
(
gpu_index
);
error
+=
initGpu
(
gpu_index
);
}
assert
(
ret
!
=
0
);
assert
(
error
=
=
0
);
toGpu
(
gpu_index
);
assert
(
ret
!
=
0
);
return
ret
;
assert
(
error
=
=
0
);
return
error
;
}
int
Query
::
fromGpu
(){
return
0
;}
Target.cu
View file @
a85081cc
...
...
@@ -22,18 +22,18 @@ size_t Target::getCpuMem(){
}
int
Target
::
loadToGpu
(
int
gpu_index
){
int
ret
=
0
;
int
error
=
0
;
if
(
!
_cpu_initiated
){
ret
+=
initCpu
();
error
+=
initCpu
();
}
assert
(
ret
!
=
0
);
assert
(
error
=
=
0
);
if
(
!
_gpu_initiated
){
ret
+=
initGpu
(
gpu_index
);
error
+=
initGpu
(
gpu_index
);
}
assert
(
ret
!
=
0
);
ret
+=
toGpu
(
gpu_index
);
assert
(
ret
!
=
0
);
return
ret
;
assert
(
error
=
=
0
);
error
+=
toGpu
(
gpu_index
);
assert
(
error
=
=
0
);
return
error
;
}
int
Target
::
initCpu
(){
...
...
ccl_test.cu
View file @
a85081cc
...
...
@@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE(fitting_protocol)
protocol
.
printGPUInfo
();
protocol
.
setFileTarget
(
"test/TauA_3.47A_map.mrc"
);
protocol
.
loadTarget
(
0
);
protocol
.
addQueryFromPdb
(
"test/
T
auA.pdb"
);
protocol
.
addQueryFromPdb
(
"test/
t
auA.pdb"
);
protocol
.
loadQueries
(
0
);
// std::pair<float3,float3> effective_translational_shift;
// effective_translational_shift.first = {0,0,0};
...
...
util.h
View file @
a85081cc
...
...
@@ -52,6 +52,7 @@ inline bool file_exists (const std::string& name) {
fclose
(
file
);
return
true
;
}
else
{
std
::
cout
<<
"File "
<<
name
<<
" is not found ..."
<<
std
::
endl
;
return
false
;
}
}
...
...
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