Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dwuggh
surfcode-rs
Commits
b16f8e95
Unverified
Commit
b16f8e95
authored
Aug 06, 2021
by
dwuggh
Browse files
add cpu number check
parent
b2c9dd9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
b16f8e95
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.15"
...
...
@@ -432,6 +434,7 @@ dependencies = [
"fastrand",
"libc",
"log",
"num_cpus",
"petgraph",
"rand",
"rayon",
...
...
Cargo.toml
View file @
b16f8e95
...
...
@@ -17,3 +17,4 @@ fastrand = "1.4.1"
clap
=
"3.0.0-beta.2"
rayon
=
"1.5"
libc
=
"0.2"
num_cpus
=
"1.13"
src/main.rs
View file @
b16f8e95
...
...
@@ -55,6 +55,11 @@ fn main() {
.arg
(
Arg
::
new
(
"channel"
)
.about
(
"channel"
))
.get_matches
();
let
cpus
=
num_cpus
::
get
();
let
cpus_physical
=
num_cpus
::
get_physical
();
println!
(
"using cpu number: {}, physical cpu number: {}"
,
cpus
,
cpus_physical
);
let
xn
=
matches
.value_of
(
"xn"
)
.unwrap
()
.parse
::
<
usize
>
()
.unwrap
();
let
zm
=
matches
.value_of
(
"zm"
)
.unwrap
()
.parse
::
<
usize
>
()
.unwrap
();
let
measure_rounds
=
matches
...
...
@@ -83,6 +88,7 @@ fn main() {
m_correct
[
0
]
=
1.
-
pm
;
let
mut
m_error
=
vec!
[
0.
;
256
];
m_error
[
0
]
=
pm
;
log
::
info!
(
"pure measurement error: {} {}"
,
m_correct
[
0
],
m_error
[
0
]);
(
m_correct
,
m_error
)
}
else
{
load_channel_coeffs_from_file
(
channel
)
...
...
@@ -95,6 +101,7 @@ fn main() {
// m_error[0] = pm;
let
measure_model
=
error
::
MeasureNoiseModel
::
new
(
m_correct
,
m_error
);
log
::
info!
(
"success prob: {}"
,
measure_model
.success.prob_sum
);
let
result
:
Vec
<
usize
>
=
(
0
..
rounds
)
.into_par_iter
()
.map
(|
_
|
runner2
(
xn
,
zm
,
measure_rounds
,
measure_model
.clone
(),
p1
))
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment