Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Dubský Jan
asgn
Commits
e5b6793b
Commit
e5b6793b
authored
Mar 22, 2020
by
Bednárek David RNDr. Ph.D.
Browse files
--threads arguments
well-defined uniform distribution in levenasgn.hpp
parent
54a06af8
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
asgn/fmwkng.hpp
View file @
e5b6793b
...
...
@@ -1959,7 +1959,7 @@ namespace fmwkng {
using
self_
=
root_data_holder
<
config_t
>
;
public:
root_data_holder
(
int
argc
,
char
**
argv
,
const
gold_data
&
gd
=
gold_data
{})
:
gd_
(
gd
),
direct_print_
(
true
)
:
gd_
(
gd
),
direct_print_
(
true
)
,
threads_
(
1
)
{
std
::
fill
(
platform_enablers_
.
begin
(),
platform_enablers_
.
end
(),
true
);
process_arguments
(
std
::
vector
<
std
::
string
>
(
argv
+
1
,
argv
+
argc
));
...
...
@@ -2122,6 +2122,10 @@ namespace fmwkng {
{
return
direct_print_
;
}
std
::
size_t
preferred_concurrency
()
const
{
return
threads_
;
}
private:
std
::
array
<
bool
,
config_t
::
platforms
::
size_v
>
platform_enablers_
;
typename
config_t
::
ranges
::
tuple_t
range_configs_
;
...
...
@@ -2132,6 +2136,7 @@ namespace fmwkng {
gold_data
gd_
;
std
::
string
machine_name_
;
bool
direct_print_
;
std
::
size_t
threads_
;
void
print_elements
()
const
{
...
...
@@ -2188,6 +2193,24 @@ namespace fmwkng {
}
}
}
{
threads_
=
std
::
thread
::
hardware_concurrency
();
try
{
#pragma warning(push)
#pragma warning(disable: 4996)
auto
env1
=
std
::
getenv
(
"SLURM_CPUS_ON_NODE"
);
#pragma warning(pop)
if
(
env1
)
{
auto
num1
=
std
::
stoi
(
env1
);
if
(
num1
>=
1
&&
num1
<=
256
)
threads_
=
num1
;
}
}
catch
(...)
{
}
}
for
(
auto
it
=
arg
.
begin
();
it
!=
arg
.
end
();
++
it
)
{
auto
&
a
=
*
it
;
...
...
@@ -2214,6 +2237,17 @@ namespace fmwkng {
{
machine_name_
=
value
;
}
else
if
(
name
==
"threads"
)
{
try
{
auto
num1
=
std
::
stoi
(
std
::
string
(
value
));
if
(
num1
>=
1
&&
num1
<=
256
)
threads_
=
num1
;
}
catch
(...)
{
}
}
else
if
(
name
==
"direct-print"
)
{
if
(
value
==
"1"
||
value
==
"true"
||
value
==
"on"
)
...
...
@@ -3828,30 +3862,9 @@ namespace fmwkng {
using
my_data
=
typename
my_tuple_t
::
my_data
;
my_tuple_t
dt_
;
static
std
::
size_t
preferred_concurrency
()
std
::
size_t
preferred_concurrency
()
const
{
static
std
::
size_t
pc
=
compute_preferred_concurrency
();
return
pc
;
}
static
std
::
size_t
compute_preferred_concurrency
()
{
try
{
#pragma warning(push)
#pragma warning(disable: 4996)
auto
env1
=
std
::
getenv
(
"SLURM_CPUS_ON_NODE"
);
#pragma warning(pop)
if
(
env1
)
{
auto
num1
=
std
::
stoi
(
env1
);
if
(
num1
>=
1
&&
num1
<=
256
)
return
num1
;
}
}
catch
(...)
{
}
return
std
::
thread
::
hardware_concurrency
();
return
my_root_pointer
()
->
preferred_concurrency
();
}
};
#pragma endregion
...
...
asgn/levenasgn.hpp
View file @
e5b6793b
...
...
@@ -92,13 +92,13 @@ namespace levenasgn {
data_element
get
()
{
return
ui_
(
engine_
);
return
data_element
(
ui_
(
engine_
)
)
;
}
private:
typedef
std
::
mt19937_64
M
;
M
engine_
;
typedef
std
::
uniform_int_distribution
<
data_element
>
D
;
typedef
fmwkng
::
well_defined_uniform
D
;
D
ui_
;
};
...
...
asgn/levengold.cpp
View file @
e5b6793b
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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