Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
qbox-public
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
qbox
qbox-public
Commits
6cc9262b
Commit
6cc9262b
authored
Aug 19, 2020
by
Francois Gygi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use serialized SlaterDet str in Wavefunction::write
parent
322ef8b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
2 deletions
+45
-2
Wavefunction.cpp
src/Wavefunction.cpp
+45
-2
No files found.
src/Wavefunction.cpp
View file @
6cc9262b
...
...
@@ -958,9 +958,12 @@ void Wavefunction::print(ostream& os, string encoding, string tag) const
os
<<
"</"
<<
tag
<<
">"
<<
endl
;
}
///////////////////////////////////////////////////////////////////////////////
/
///////////////////////////////////////////////////////////////////////////////
void
Wavefunction
::
write
(
SharedFilePtr
&
sfp
,
string
encoding
,
string
tag
)
const
{
assert
(
sizeof
(
size_t
)
==
sizeof
(
MPI_Offset
));
assert
(
sizeof
(
long
long
int
)
==
sizeof
(
MPI_Offset
));
sfp
.
sync
();
if
(
MPIdata
::
onpe0
()
)
...
...
@@ -997,16 +1000,56 @@ void Wavefunction::write(SharedFilePtr& sfp, string encoding, string tag) const
sfp
.
sync
();
vector
<
vector
<
string
>
>
sdstr
;
sdstr
.
resize
(
nsp_loc
());
for
(
int
isp_loc
=
0
;
isp_loc
<
nsp_loc
();
++
isp_loc
)
{
const
int
ispin
=
isp_global
(
isp_loc
);
sdstr
[
isp_loc
].
resize
(
nkp_loc
());
for
(
int
ikp_loc
=
0
;
ikp_loc
<
nkp_loc
();
++
ikp_loc
)
{
const
int
ikp
=
ikp_global
(
ikp_loc
);
// serialize sd[isp_loc][ikp_loc] into sdstr[isp_loc][ikp_loc]
sd_
[
isp_loc
][
ikp_loc
]
->
str
(
sdstr
[
isp_loc
][
ikp_loc
],
encoding
,
weight_
[
ikp
],
ispin
,
nspin_
);
}
}
// sdstr now contains all data to be written
// write data in order of increasing ispin, ikp
for
(
int
ispin
=
0
;
ispin
<
nspin
();
++
ispin
)
{
for
(
int
ikp
=
0
;
ikp
<
nkp
();
++
ikp
)
{
MPI_Barrier
(
MPIdata
::
comm
());
const
int
isp_loc
=
isp_local
(
ispin
);
const
int
ikp_loc
=
ikp_local
(
ikp
);
const
char
*
wbuf
=
0
;
size_t
len
=
0
;
MPI_Offset
off
=
0
;
if
(
(
isp_loc
>=
0
)
&&
(
ikp_loc
>=
0
)
)
{
sd_
[
isp_loc
][
ikp_loc
]
->
write
(
sfp
,
encoding
,
weight_
[
ikp
],
ispin
,
nspin_
);
wbuf
=
sdstr
[
isp_loc
][
ikp_loc
].
c_str
();
len
=
sdstr
[
isp_loc
][
ikp_loc
].
size
();
// compute offset of data on current task
long
long
int
local_offset
=
0
;
long
long
int
local_size
=
len
;
MPI_Scan
(
&
local_size
,
&
local_offset
,
1
,
MPI_LONG_LONG
,
MPI_SUM
,
MPIdata
::
sd_comm
());
// correct for inclusive scan by subtracting local_size
local_offset
-=
local_size
;
off
=
sfp
.
offset
()
+
local_offset
;
}
MPI_Status
status
;
int
err
=
MPI_File_write_at_all
(
sfp
.
file
(),
off
,
wbuf
,
len
,
MPI_CHAR
,
&
status
);
int
count
;
MPI_Get_count
(
&
status
,
MPI_CHAR
,
&
count
);
assert
(
count
==
len
);
if
(
err
!=
0
)
cout
<<
" Wavefunction::write: error in MPI_File_write_at_all"
<<
endl
;
sfp
.
set_offset
(
off
+
len
);
sfp
.
sync
();
}
}
...
...
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