Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs267
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
recolic-hust
cs267
Commits
29dfce26
There was an error fetching the commit references. Please try again later.
Commit
29dfce26
authored
6 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/new_idea'
parents
8b462847
52f86fba
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hw3/kmer_hash.cpp
+51
-36
51 additions, 36 deletions
hw3/kmer_hash.cpp
with
51 additions
and
36 deletions
hw3/kmer_hash.cpp
+
51
−
36
View file @
29dfce26
...
@@ -72,7 +72,7 @@ int main(int argc, char **argv) {
...
@@ -72,7 +72,7 @@ int main(int argc, char **argv) {
throw
std
::
runtime_error
(
"Error: HashMap is full!"
);
throw
std
::
runtime_error
(
"Error: HashMap is full!"
);
}
}
if
(
kmer
.
backwardExt
()
==
'F'
)
{
if
(
upcxx
::
rank_me
()
==
0
and
kmer
.
backwardExt
()
==
'F'
)
{
start_nodes
.
push_back
(
kmer
);
start_nodes
.
push_back
(
kmer
);
}
}
}
}
...
@@ -87,52 +87,67 @@ int main(int argc, char **argv) {
...
@@ -87,52 +87,67 @@ int main(int argc, char **argv) {
auto
start_read
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
start_read
=
std
::
chrono
::
high_resolution_clock
::
now
();
std
::
list
<
std
::
list
<
kmer_pair
>>
contigs
;
std
::
list
<
std
::
list
<
kmer_pair
>>
contigs
;
//assume it is global addressed
for
(
const
auto
&
start_kmer
:
start_nodes
)
{
if
(
upcxx
::
rank_me
()
==
0
){
std
::
list
<
kmer_pair
>
contig
;
for
(
const
auto
&
start_kmer
:
start_nodes
)
{
contig
.
push_back
(
start_kmer
);
std
::
list
<
kmer_pair
>
contig
;
while
(
contig
.
back
().
forwardExt
()
!=
'F'
)
{
contig
.
push_back
(
start_kmer
);
kmer_pair
kmer
;
contigs
.
push_back
(
contig
);
bool
success
=
hashmap
.
find
(
contig
.
back
().
next_kmer
(),
kmer
);
}
if
(
!
success
)
{
//now broadcast contigs, and broadcast the number of contig inside contigs to every processor
throw
std
::
runtime_error
(
"Error: k-mer not found in hashmap."
);
}
// the following will be done by every processor
bool
all_done
=
false
;
while
(
all_done
==
false
){
for
(
int
num
=
0
;
num
<
num_contig
;
num
++
){
check_if_this_contig_ends_with_F
//update all_done
fetch_last_kmer_if_needed
(
contigs
[
i
],
upcxx
::
rank_me
()).
wait
();
//return success,and contigs[i].back().next_kmer()
if
(
fetch_last_kmer_if_needed
.
success
==
true
){
kmer_pair
kmer
;
bool
success
=
hashmap
.
find
(
fetch_last_kmer_if_needed
.
next_kmer
,
kmer
);
if
(
!
success
)
{
//panic!
}
remotely_push_kmer_into_contig
(
contigs
[
i
],
kmer
)
//contig.push_back(kmer);
}
}
contig
.
push_back
(
kmer
);
}
}
contigs
.
push_back
(
contig
);
}
}
auto
end_read
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
end_read
=
std
::
chrono
::
high_resolution_clock
::
now
();
upcxx
::
barrier
();
upcxx
::
barrier
();
auto
end
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
end
=
std
::
chrono
::
high_resolution_clock
::
now
();
if
(
upcxx
::
rank_me
()
==
0
){
std
::
chrono
::
duration
<
double
>
read
=
end_read
-
start_read
;
std
::
chrono
::
duration
<
double
>
insert
=
end_insert
-
start
;
std
::
chrono
::
duration
<
double
>
total
=
end
-
start
;
int
numKmers
=
std
::
accumulate
(
contigs
.
begin
(),
contigs
.
end
(),
0
,
[]
(
int
sum
,
const
std
::
list
<
kmer_pair
>
&
contig
)
{
return
sum
+
contig
.
size
();
});
if
(
run_type
!=
"test"
)
{
BUtil
::
print
(
"Assembled in %lf total
\n
"
,
total
.
count
());
}
std
::
chrono
::
duration
<
double
>
read
=
end_read
-
start_read
;
if
(
run_type
==
"verbose"
)
{
std
::
chrono
::
duration
<
double
>
insert
=
end_insert
-
start
;
printf
(
"Rank %d reconstructed %d contigs with %d nodes from %d start nodes."
std
::
chrono
::
duration
<
double
>
total
=
end
-
start
;
" (%lf read, %lf insert, %lf total)
\n
"
,
upcxx
::
rank_me
(),
contigs
.
size
(),
numKmers
,
start_nodes
.
size
(),
read
.
count
(),
insert
.
count
(),
total
.
count
());
int
numKmers
=
std
::
accumulate
(
contigs
.
begin
(),
contigs
.
end
(),
0
,
}
[]
(
int
sum
,
const
std
::
list
<
kmer_pair
>
&
contig
)
{
return
sum
+
contig
.
size
();
});
if
(
run_type
!=
"test"
)
{
BUtil
::
print
(
"Assembled in %lf total
\n
"
,
total
.
count
());
}
if
(
run_type
==
"verbose"
)
{
printf
(
"Rank %d reconstructed %d contigs with %d nodes from %d start nodes."
" (%lf read, %lf insert, %lf total)
\n
"
,
upcxx
::
rank_me
(),
contigs
.
size
(),
numKmers
,
start_nodes
.
size
(),
read
.
count
(),
insert
.
count
(),
total
.
count
());
}
if
(
run_type
==
"test"
)
{
if
(
run_type
==
"test"
)
{
std
::
ofstream
fout
(
"test_"
+
std
::
to_string
(
upcxx
::
rank_me
())
+
".dat"
);
std
::
ofstream
fout
(
"test_"
+
std
::
to_string
(
upcxx
::
rank_me
())
+
".dat"
);
for
(
const
auto
&
contig
:
contigs
)
{
for
(
const
auto
&
contig
:
contigs
)
{
fout
<<
extract_contig
(
contig
)
<<
std
::
endl
;
fout
<<
extract_contig
(
contig
)
<<
std
::
endl
;
}
fout
.
close
();
}
}
fout
.
close
();
}
}
upcxx
::
finalize
();
upcxx
::
finalize
();
return
0
;
return
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