Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
2e1b2108
Commit
2e1b2108
authored
1 year ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Use null character to terminate chunk buffers
parent
3752471c
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cluster/cluster.cpp
+6
-3
6 additions, 3 deletions
src/cluster/cluster.cpp
with
6 additions
and
3 deletions
src/cluster/cluster.cpp
+
6
−
3
View file @
2e1b2108
...
...
@@ -324,7 +324,7 @@ void cluster(const string& config_file, const string& data_file, const string& o
delete
[]
chunk_buffer
;
MPI_Recv
(
&
chunk_buffer_size
,
1
,
MPI_INT
,
rr
,
1
,
MPI_COMM_WORLD
,
MPI_STATUS_IGNORE
);
}
fp
utc
(
10
,
output
);
fp
rintf
(
output
,
"
\n
"
);
// now get the binary local file
long
buffer_size
=
0
;
...
...
@@ -454,7 +454,7 @@ void cluster(const string& config_file, const string& data_file, const string& o
// If EOF is reached, do not send EOF character.
long
ptr_position
=
partial_output
.
tellg
();
if
(
ptr_position
==
partial_output_size
)
{
chunk_buffer
_size
--
;
chunk_buffer
[
chunk_buffer_size
-
1
]
=
'\0'
;
}
// Send the size of the buffer that is being transmitted (Node-0 does not know whether it is full or not)
MPI_Send
(
&
chunk_buffer_size
,
1
,
MPI_INT
,
0
,
1
,
MPI_COMM_WORLD
);
...
...
@@ -464,8 +464,11 @@ void cluster(const string& config_file, const string& data_file, const string& o
long
ptr_position
=
partial_output
.
tellg
();
if
(
ptr_position
<
partial_output_size
)
{
// Send the last partial buffer
chunk_buffer_size
=
partial_output_size
-
ptr_position
-
1
;
chunk_buffer_size
=
partial_output_size
-
ptr_position
;
delete
[]
chunk_buffer
;
chunk_buffer
=
new
char
[
chunk_buffer_size
];
partial_output
.
read
(
chunk_buffer
,
chunk_buffer_size
);
chunk_buffer
[
chunk_buffer_size
-
1
]
=
'\0'
;
// Send the size of the buffer that is being transmitted (Node-0 does not know whether it is full or not)
MPI_Send
(
&
chunk_buffer_size
,
1
,
MPI_INT
,
0
,
1
,
MPI_COMM_WORLD
);
// Actually send the file contents to Node-0
...
...
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