Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mpi-par
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
alesanc
mpi-par
Commits
bf26d145
Commit
bf26d145
authored
Jun 8, 2024
by
alexgara
Browse files
Options
Downloads
Patches
Plain Diff
error in second loop
parent
2e2666e2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
align_mpi.c
+22
-8
22 additions, 8 deletions
align_mpi.c
test-resports.txt
+1
-1
1 addition, 1 deletion
test-resports.txt
with
23 additions
and
9 deletions
align_mpi.c
+
22
−
8
View file @
bf26d145
...
...
@@ -33,7 +33,7 @@
#define END_SIG -2
/* Macro for checking mpi funcs and print if there is a error */
#define MPI_CHEK_FUCKTION( call) {int ierr =
1
; int resultlen; if (ierr != MPI_SUCCESS){ char error_msg[MPI_MAX_ERROR_STRING]; MPI_Error_string(ierr, error_msg, &resultlen); fprintf(stderr, "MPI fallo en linea (%d):\n%s\n", __LINE__, error_msg); MPI_Abort(MPI_COMM_WORLD,
-1
);}}
#define MPI_CHEK_FUCKTION( call
) {int ierr =
call
; int resultlen; if (ierr != MPI_SUCCESS){ char error_msg[MPI_MAX_ERROR_STRING]; MPI_Error_string(ierr, error_msg, &resultlen); fprintf(stderr, "MPI fallo en linea (%d):\n%s\n
\n
", __LINE__, error_msg); MPI_Abort(MPI_COMM_WORLD,
EXIT_FAILURE); fflush(stdout
);}}
/*
* Function: Increment the number of pattern matches on the sequence positions
...
...
@@ -401,6 +401,7 @@ int main(int argc, char *argv[]) {
fprintf
(
stderr
,
"Error al crear envio_array en proc:%d
\n
"
,
rank
);
MPI_Abort
(
MPI_COMM_WORLD
,
EXIT_FAILURE
);
}
unsigned
long
*
recibo_array
=
(
unsigned
long
*
)
malloc
(
sizeof
(
unsigned
long
)
*
3
);
if
(
recibo_array
==
NULL
)
{
fprintf
(
stderr
,
"Error al crear recibo_array en proc:%d
\n
"
,
rank
);
...
...
@@ -422,7 +423,6 @@ int main(int argc, char *argv[]) {
envio_array
[
2
]
=
pat
;
//Envio el parton para que continue el siguente que le toca
MPI_CHEK_FUCKTION
(
MPI_Isend
(
envio_array
,
3
,
MPI_UNSIGNED_LONG
,
rank
+
1
,
TAG_NO_COMPLETE
,
MPI_COMM_WORLD
,
&
request
));
send_to_continue_flag
=
1
;
break
;
...
...
@@ -450,9 +450,13 @@ int main(int argc, char *argv[]) {
envio_array
[
1
]
=
(
unsigned
long
)
END_SIG
;
envio_array
[
2
]
=
(
unsigned
long
)
END_SIG
;
MPI_CHEK_FUCKTION
(
MPI_Isend
(
envio_array
,
3
,
MPI_UNSIGNED_LONG
,
rank
+
1
,
TAG_END
,
MPI_COMM_WORLD
,
&
request
));
}
MPI_CHEK_FUCKTION
(
MPI_Barrier
(
MPI_COMM_WORLD
));
printf
(
"==================
\n
rank=%d LLEGA pat=%lu, sig=%d
\n
"
,
rank
,
pat
,
rank
+
1
);
fflush
(
stdout
);
MPI_CHEK_FUCKTION
(
MPI_Barrier
(
MPI_COMM_WORLD
));
//NOW PROCESS CHECK FOR THE REAMAING PATTERN THAT ITS PREVIOUS DOSENT HAVE FOUND
int
start_r
,
pat_r
,
length_r
;
while
(
1
&&
(
rank
!=
0
)){
...
...
@@ -461,8 +465,10 @@ int main(int argc, char *argv[]) {
//First check if the previous process has finished & have nothing more to do
MPI_CHEK_FUCKTION
(
MPI_Recv
(
recibo_array
,
3
,
MPI_UNSIGNED_LONG
,
rank
-
1
,
MPI_ANY_TAG
,
MPI_COMM_WORLD
,
&
status
));
printf
(
"
\n
RECIBE(%d) rank=%d desde rank-1=%d pat=%lu con TAG=%d
\n
"
,
(
status
.
MPI_TAG
==
TAG_END
)
,
rank
,
status
.
MPI_SOURCE
,
recibo_array
[
2
],
status
.
MPI_TAG
);
//THEN its end sigal the first so no more thing to do
if
(
status
.
MPI_TAG
==
END_SIG
)
break
;
if
(
status
.
MPI_TAG
==
TAG_END
)
break
;
//else continue because the rank-1 send work to do
start_r
=
recibo_array
[
0
];
...
...
@@ -480,6 +486,7 @@ int main(int argc, char *argv[]) {
//Send to the next rank
MPI_CHEK_FUCKTION
(
MPI_Isend
(
envio_array
,
3
,
MPI_UNSIGNED_LONG
,
rank
+
1
,
TAG_NO_COMPLETE
,
MPI_COMM_WORLD
,
&
request
));
//printf("\n ENVIA(%d) rank=%d a rank+1=%d pat=%lu\n", (1), rank, rank+1, envio_array[2]);
send_to_continue_flag
=
1
;
break
;
}
...
...
@@ -498,6 +505,9 @@ int main(int argc, char *argv[]) {
}
}
printf
(
"
\n
TERMINO rank=%d LLEGA pat=%lu, sig=%d
\n
"
,
rank
,
pat
,
rank
+
1
);
fflush
(
stdout
);
//If its outside then send signal to the next that there is no more patterns
if
(
rank
!=
0
){
envio_array
[
0
]
=
END_SIG
;
...
...
@@ -505,6 +515,7 @@ int main(int argc, char *argv[]) {
envio_array
[
2
]
=
END_SIG
;
MPI_CHEK_FUCKTION
(
MPI_Isend
(
envio_array
,
3
,
MPI_UNSIGNED_LONG
,
rank
+
1
,
TAG_END
,
MPI_COMM_WORLD
,
&
request
));
}
MPI_CHEK_FUCKTION
(
MPI_Barrier
(
MPI_COMM_WORLD
));
unsigned
long
*
recive_pat_found
;
...
...
@@ -533,11 +544,13 @@ int main(int argc, char *argv[]) {
//The other ranks send to the master
MPI_CHEK_FUCKTION
(
MPI_Reduce
(
pat_found
,
NULL
,
pat_number
,
MPI_UNSIGNED_LONG
,
MPI_MIN
,
0
,
MPI_COMM_WORLD
));
if
(
rank
==
1
||
rank
==
2
)
if
(
rank
==
1
||
rank
==
2
)
{
MPI_CHEK_FUCKTION
(
MPI_Recv
(
recive_pat_found
,
pat_number
,
MPI_UNSIGNED_LONG
,
0
,
TAG_SEND_PAT_FOUND
,
MPI_COMM_WORLD
,
&
status
));
}
}
/* 7. Check sums */
unsigned
long
checksum_matches
=
0
;
unsigned
long
checksum_found
=
0
;
...
...
@@ -560,8 +573,9 @@ int main(int argc, char *argv[]) {
}
//Recv the calculated checksum from rank 1
if
(
rank
==
0
)
if
(
rank
==
0
)
{
MPI_CHEK_FUCKTION
(
MPI_Recv
(
&
checksum_found
,
1
,
MPI_UNSIGNED_LONG
,
1
,
TAG_SEND_CHECKSUM
,
MPI_COMM_WORLD
,
&
status
));
}
// rank 2 TODO calculate checksum_matches
/** Esta parte de momento la consideramos opcional
...
...
This diff is collapsed.
Click to expand it.
test-resports.txt
+
1
−
1
View file @
bf26d145
$
./align_seq 500000 0.15 0.4 0.15 1120 20 10 2110 50000 500 7000 4000 M 346536
./align_seq 500000 0.15 0.4 0.15 1120 20 10 2110 50000 500 7000 4000 M 346536
Time: 10.761040
Result: 1900, 5291, 30391, 17177
...
...
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