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
5f73b6f6
Commit
5f73b6f6
authored
Aug 19, 2020
by
Francois Gygi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove USE_MPI, update size and offset types
parent
1fb34083
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
17 deletions
+18
-17
SlaterDet.cpp
src/SlaterDet.cpp
+18
-17
No files found.
src/SlaterDet.cpp
View file @
5f73b6f6
...
...
@@ -1562,10 +1562,8 @@ void SlaterDet::write(SharedFilePtr& sfp, string encoding, double weight,
// do not write anything if nst==0
if
(
nst
()
==
0
)
return
;
#if USE_MPI
char
*
wbuf
=
0
;
size_t
wbufsize
=
0
;
#endif
// Segment n on process iprow is sent to row (n*nprow+iprow)/(nprow)
const
int
nprow
=
ctxt_
.
nprow
();
...
...
@@ -1839,7 +1837,6 @@ void SlaterDet::write(SharedFilePtr& sfp, string encoding, double weight,
// seg is defined
#if USE_MPI
// redistribute segments to tasks within each process column
for
(
int
i
=
0
;
i
<
nprow
;
i
++
)
...
...
@@ -1857,7 +1854,7 @@ void SlaterDet::write(SharedFilePtr& sfp, string encoding, double weight,
MPI_Alltoall
(
&
scounts
[
0
],
1
,
MPI_INT
,
&
rcounts
[
0
],
1
,
MPI_INT
,
MPIdata
::
g_comm
());
// dimension receive buffer
in
t
rbufsize
=
rcounts
[
0
];
size_
t
rbufsize
=
rcounts
[
0
];
rdispl
[
0
]
=
0
;
for
(
int
i
=
1
;
i
<
ctxt_
.
nprow
();
i
++
)
{
...
...
@@ -1895,37 +1892,41 @@ void SlaterDet::write(SharedFilePtr& sfp, string encoding, double weight,
wbufsize
+=
rbufsize
;
}
delete
[]
rbuf
;
#else
sfp
.
file
().
write
(
seg
.
data
(),
seg
.
size
());
#endif
}
// wbuf now contains the data to be written in the correct order
// wbuf now contains the data to be written in order of
// increasing sd rank
ctxt_
.
barrier
();
MPI_Offset
off
;
long
long
int
local_offset
,
current_offset
;
current_offset
=
sfp
.
offset
();
assert
(
sizeof
(
size_t
)
==
sizeof
(
MPI_Offset
))
;
assert
(
sizeof
(
long
long
int
)
==
sizeof
(
MPI_Offset
))
;
MPI_Offset
current_offset
=
sfp
.
offset
();
long
long
int
local_offset
=
0
;
// compute local offset of next write
long
long
int
local_size
=
wbufsize
;
MPI_Scan
(
&
local_size
,
&
local_offset
,
1
,
MPI_LONG_LONG
,
MPI_SUM
,
ctxt_
.
comm
());
//
add base and
correct for inclusive scan by subtracting local_size
local_offset
+=
current_offset
-
local_size
;
off
=
local_offset
;
// correct for inclusive scan by subtracting local_size
local_offset
-=
local_size
;
MPI_Offset
off
=
current_offset
+
local_offset
;
MPI_Status
status
;
#ifdef DEBUG
cout
<<
MPIdata
::
rank
()
<<
" MPI_File_write_at: "
<<
"off= "
<<
off
<<
" size= "
<<
wbufsize
<<
" off+size-1= "
<<
off
+
wbufsize
-
1
<<
endl
;
#endif
// write wbuf from all tasks using computed offset
int
len
=
wbufsize
;
int
err
=
MPI_File_write_at
(
sfp
.
file
(),
off
,(
void
*
)
wbuf
,
len
,
int
err
=
MPI_File_write_at
(
sfp
.
file
(),
off
,(
void
*
)
wbuf
,
wbufsize
,
MPI_CHAR
,
&
status
);
if
(
err
!=
0
)
cout
<<
ctxt_
.
mype
()
<<
" error in MPI_File_write_at: err="
<<
err
<<
endl
;
sfp
.
set_offset
(
local_offset
+
len
);
sfp
.
set_offset
(
off
+
wbufsize
);
delete
[]
wbuf
;
}
...
...
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