Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mpi-mandelbrot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Kempe
mpi-mandelbrot
Commits
79e0d716
Commit
79e0d716
authored
Oct 4, 2015
by
Andreas Kempe
Browse files
Options
Downloads
Patches
Plain Diff
Corrected an error where the root process was rendering too much.
parent
2cbf0688
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
server/mandel_render_srv.cpp
+14
-6
14 additions, 6 deletions
server/mandel_render_srv.cpp
with
14 additions
and
6 deletions
server/mandel_render_srv.cpp
+
14
−
6
View file @
79e0d716
...
...
@@ -11,7 +11,7 @@ using namespace Magick;
mandel_render_srv
::
mandel_render_srv
(
std
::
string
host
,
unsigned
int
port
,
int
id
,
int
procs
,
QObject
*
parent
)
:
QObject
(
parent
),
settings
(
settings
),
id
(
id
),
procs
(
procs
)
QObject
(
parent
),
id
(
id
),
procs
(
procs
)
{
// We only let the root process connect to the client.
if
(
id
==
0
)
...
...
@@ -57,17 +57,17 @@ void mandel_render_srv::start_drawing()
void
mandel_render_srv
::
root_process_handling
(
unsigned
long
*
receive_buffer
)
{
Image
my_image
(
Geometry
(
settings
.
img_width
,
settings
.
img_height
),
"white"
);
Image
my_image
(
Geometry
(
settings
.
img_width
,
settings
.
img_height
*
procs
),
"white"
);
my_image
.
modifyImage
();
Pixels
pixel_cache
(
my_image
);
PixelPacket
*
pixels
=
pixel_cache
.
get
(
0
,
0
,
settings
.
img_width
,
settings
.
img_height
);
PixelPacket
*
pixels
=
pixel_cache
.
get
(
0
,
0
,
settings
.
img_width
,
settings
.
img_height
*
procs
);
cout
<<
"Assembling image!"
<<
endl
;
for
(
unsigned
long
y
=
0
;
y
<
settings
.
img_height
;
++
y
)
for
(
unsigned
long
y
=
0
;
y
<
settings
.
img_height
*
procs
;
++
y
)
{
cout
<<
"Progress: "
<<
setprecision
(
3
)
<<
static_cast
<
float
>
(
y
*
100
)
/
(
settings
.
img_height
)
<<
" %
\r
"
<<
flush
;
static_cast
<
float
>
(
y
*
100
)
/
(
settings
.
img_height
*
procs
)
<<
" %
\r
"
<<
flush
;
for
(
unsigned
long
x
=
0
;
x
<
settings
.
img_width
;
++
x
)
{
...
...
@@ -155,6 +155,8 @@ void mandel_render_srv::handle_recv_data()
settings
=
recv_settings
;
settings
.
img_height
/=
procs
;
double
mpi_data
[
8
];
mpi_data
[
0
]
=
static_cast
<
double
>
(
mpi_opcodes
::
RENDER
);
...
...
@@ -163,7 +165,7 @@ void mandel_render_srv::handle_recv_data()
mpi_data
[
3
]
=
settings
.
im_max
;
mpi_data
[
4
]
=
settings
.
im_min
;
mpi_data
[
5
]
=
settings
.
img_width
;
mpi_data
[
6
]
=
settings
.
img_height
/
procs
;
mpi_data
[
6
]
=
settings
.
img_height
;
mpi_data
[
7
]
=
settings
.
iterations
;
// Send current render settings to other processes.
...
...
@@ -173,6 +175,12 @@ void mandel_render_srv::handle_recv_data()
MPI_Send
(
mpi_data
,
8
,
MPI_DOUBLE
,
i
,
0
,
MPI_COMM_WORLD
);
}
// Update the settings for the root process.
double
im_max
=
settings
.
im_max
;
double
im_min
=
settings
.
im_min
;
settings
.
im_max
=
get_max_im
(
im_max
,
im_min
,
0
,
procs
);
settings
.
im_min
=
get_min_im
(
im_max
,
im_min
,
0
,
procs
);
start_drawing
();
break
;
}
...
...
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