Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pp-heatmap
Project
Project
Details
Activity
Releases
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
Björn Fischer
pp-heatmap
Commits
184196c8
Commit
184196c8
authored
Dec 30, 2015
by
Björn Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename pid to rank
parent
8b3c5cc0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
22 deletions
+22
-22
jan
jan
+0
-0
proj
proj
+0
-0
proj.c
proj.c
+22
-22
No files found.
jan
deleted
100755 → 0
View file @
8b3c5cc0
File deleted
proj
View file @
184196c8
No preview for this file type
proj.c
View file @
184196c8
...
...
@@ -27,9 +27,9 @@ int main(int argc, char **argv)
process_args
(
argc
,
argv
,
&
m
,
&
n
,
&
eps
,
&
delta_t
);
int
pid
,
num_p
;
if
(
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
pid
))
{
fprintf
(
stderr
,
"Cannot fetch
PID
\n
"
);
int
rank
,
num_p
;
if
(
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
))
{
fprintf
(
stderr
,
"Cannot fetch
rank
\n
"
);
exit
(
1
);
}
...
...
@@ -38,15 +38,15 @@ int main(int argc, char **argv)
exit
(
1
);
}
if
(
pid
==
0
)
{
if
(
rank
==
0
)
{
root_field
=
New_Matrix
(
m
,
n
);
if
(
root_field
==
NULL
)
{
fprintf
(
stderr
,
"
PID %s: Can't allocate root_field !
\n
"
,
pid
);
fprintf
(
stderr
,
"
rank %s: Can't allocate root_field !
\n
"
,
rank
);
exit
(
1
);
}
}
if
(
pid
==
0
)
{
if
(
rank
==
0
)
{
printf
(
"number of processes: %d
\n
"
,
num_p
);
}
...
...
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
m_per_pro
=
ceil
(
m
/
(
float
)
pro_per_dim
[
1
]);
n_per_pro
=
ceil
(
n
/
(
float
)
pro_per_dim
[
0
]);
if
(
pid
==
0
)
{
if
(
rank
==
0
)
{
printf
(
"dim0: %d dim1: %d
\n
"
,
pro_per_dim
[
0
],
pro_per_dim
[
1
]);
printf
(
"size per pro: %dx%d
\n
"
,
m_per_pro
,
n_per_pro
);
}
...
...
@@ -75,12 +75,12 @@ int main(int argc, char **argv)
exit
(
1
);
}
if
(
cart_comm
==
MPI_COMM_NULL
)
{
printf
(
"process %d not in use. exiting...
\n
"
,
pid
);
printf
(
"process %d not in use. exiting...
\n
"
,
rank
);
MPI_Finalize
();
exit
(
0
);
}
int
coord
[
2
];
if
(
MPI_Cart_coords
(
cart_comm
,
pid
,
2
,
coord
))
{
if
(
MPI_Cart_coords
(
cart_comm
,
rank
,
2
,
coord
))
{
fprintf
(
stderr
,
"Cannot get coordinates
\n
"
);
exit
(
1
);
}
...
...
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
}
pi
.
coord0
=
coord
[
0
];
pi
.
coord1
=
coord
[
1
];
pi
.
rank
=
pid
;
pi
.
rank
=
rank
;
int
matrix_size
[
2
];
matrix_size
[
0
]
=
pi
.
end_m
-
pi
.
start_m
+
3
;
...
...
@@ -109,7 +109,7 @@ int main(int argc, char **argv)
exit
(
1
);
}
if
(
pid
==
0
)
{
if
(
rank
==
0
)
{
infos
=
malloc
(
sizeof
(
t_process_info
)
*
num_p
);
}
...
...
@@ -120,9 +120,9 @@ int main(int argc, char **argv)
int
i
,
j
;
if
(
pid
==
0
)
{
if
(
rank
==
0
)
{
for
(
i
=
0
;
i
<
num_p
;
i
++
)
{
printf
(
"
pid
: %d->(%d,%d) from (%d, %d) to (%d,%d)
\n
"
,
printf
(
"
rank
: %d->(%d,%d) from (%d, %d) to (%d,%d)
\n
"
,
infos
[
i
].
rank
,
infos
[
i
].
coord0
,
infos
[
i
].
coord1
,
...
...
@@ -137,8 +137,8 @@ int main(int argc, char **argv)
double
delta_a
;
partial_field
=
New_Matrix
(
matrix_size
[
0
],
matrix_size
[
1
]);
if
(
partial_field
==
NULL
)
{
fprintf
(
stderr
,
"
PID
%d: Can't allocate partial_field %d, %d end_M: %d, start_m: %d, end_n: %d, start_n: %d!
\n
"
,
pid
,
fprintf
(
stderr
,
"
rank
%d: Can't allocate partial_field %d, %d end_M: %d, start_m: %d, end_n: %d, start_n: %d!
\n
"
,
rank
,
matrix_size
[
0
],
matrix_size
[
1
],
pi
.
end_m
,
...
...
@@ -172,7 +172,7 @@ int main(int argc, char **argv)
double
max_delta_t
=
0
.
25
*
((
min
(
hx
,
hy
))
*
(
min
(
hx
,
hy
)))
/
alpha
;
/* minimaler Wert für Konvergenz */
if
(
delta_t
>
max_delta_t
)
{
delta_t
=
max_delta_t
;
if
(
pid
==
0
)
if
(
rank
==
0
)
printf
(
"Info: delta_t set to %.10lf.
\n
"
,
delta_t
);
}
...
...
@@ -247,16 +247,16 @@ int main(int argc, char **argv)
partial_field_tmp
=
partial_field
;
partial_field
=
swap
;
printf
(
"comp
pid %d: max: %.10lf eps: %.10lf
\n
"
,
pid
,
maxdiff
,
eps
);
printf
(
"comp
rank %d: max: %.10lf eps: %.10lf
\n
"
,
rank
,
maxdiff
,
eps
);
int
completion
=
maxdiff
<=
eps
;
printf
(
"
pid %d completion %d
\n
"
,
pid
,
completion
);
printf
(
"
rank %d completion %d
\n
"
,
rank
,
completion
);
if
(
MPI_Allgather
(
&
completion
,
1
,
MPI_INT
,
completions
,
1
,
MPI_INT
,
cart_comm
))
{
fprintf
(
stderr
,
"Alltoall failed
\n
"
);
exit
(
1
);
}
for
(
i
=
0
;
i
<
num_p
;
i
++
)
{
printf
(
"
pid %d: %d -> %d
\n
"
,
pid
,
i
,
completions
[
i
]);
printf
(
"
rank %d: %d -> %d
\n
"
,
rank
,
i
,
completions
[
i
]);
}
int
all_completed
=
1
;
for
(
i
=
0
;
i
<
num_p
;
i
++
)
{
...
...
@@ -266,7 +266,7 @@ int main(int argc, char **argv)
}
}
if
(
all_completed
)
{
printf
(
"
pid: %d: break after %d iterations
\n
"
,
pid
,
k
);
printf
(
"
rank: %d: break after %d iterations
\n
"
,
rank
,
k
);
break
;
}
...
...
@@ -325,7 +325,7 @@ int main(int argc, char **argv)
}
}
if
(
all_completed
)
{
printf
(
"
pid: %d: break after %d iterations
\n
"
,
pid
,
k
);
printf
(
"
rank: %d: break after %d iterations
\n
"
,
rank
,
k
);
break
;
}
}
...
...
@@ -342,7 +342,7 @@ int main(int argc, char **argv)
//Send_To_Root(partial_field, pi.end_m - pi.start_m + 2, pi.end_n - pi.start_n + 2);
MPI_Send
(
partial_field
[
0
],
matrix_size
[
0
]
*
matrix_size
[
1
],
MPI_DOUBLE
,
0
,
0
,
cart_comm
);
if
(
pid
==
0
)
{
if
(
rank
==
0
)
{
MPI_Request
*
requests
=
malloc
(
sizeof
(
MPI_Request
)
*
num_p
);
double
**
allocation
=
malloc
(
sizeof
(
double
*
)
*
num_p
);
for
(
i
=
0
;
i
<
num_p
;
i
++
)
{
...
...
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