Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
d4df45ed
Commit
d4df45ed
authored
Dec 18, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all opencl references
parent
25dc1ce3
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
145 deletions
+84
-145
Jenkinsfile
Jenkinsfile
+0
-2
libcaf_core/caf/actor_system.hpp
libcaf_core/caf/actor_system.hpp
+1
-9
libcaf_core/caf/actor_system_config.hpp
libcaf_core/caf/actor_system_config.hpp
+0
-4
libcaf_core/caf/fwd.hpp
libcaf_core/caf/fwd.hpp
+0
-8
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+17
-34
libcaf_core/src/actor_system_config.cpp
libcaf_core/src/actor_system_config.cpp
+17
-18
tools/caf-run.cpp
tools/caf-run.cpp
+49
-70
No files found.
Jenkinsfile
View file @
d4df45ed
...
...
@@ -5,7 +5,6 @@
// Default CMake flags for release builds.
defaultReleaseBuildFlags
=
[
'CAF_ENABLE_RUNTIME_CHECKS:BOOL=yes'
,
'CAF_NO_OPENCL:BOOL=yes'
,
]
// Default CMake flags for debug builds.
...
...
@@ -112,7 +111,6 @@ config = [
'libcaf_core/test'
,
'libcaf_io/test'
,
'libcaf_openssl/test'
,
'libcaf_opencl'
,
],
],
]
...
...
libcaf_core/caf/actor_system.hpp
View file @
d4df45ed
...
...
@@ -153,7 +153,6 @@ public:
enum
id_t
{
scheduler
,
middleman
,
opencl_manager
,
openssl_manager
,
network_manager
,
num_ids
...
...
@@ -270,13 +269,6 @@ public:
/// @throws `std::logic_error` if module is not loaded.
io
::
middleman
&
middleman
();
/// Returns `true` if the opencl module is available, `false` otherwise.
bool
has_opencl_manager
()
const
;
/// Returns the manager instance from the OpenCL module.
/// @throws `std::logic_error` if module is not loaded.
opencl
::
manager
&
opencl_manager
()
const
;
/// Returns `true` if the openssl module is available, `false` otherwise.
bool
has_openssl_manager
()
const
;
...
...
@@ -593,7 +585,7 @@ private:
void
check_invariants
()
{
static_assert
(
!
std
::
is_base_of
<
prohibit_top_level_spawn_marker
,
T
>::
value
,
"This actor type cannot be spawned through an actor system. "
"Probably you have tried to spawn a broker
or opencl actor
."
);
"Probably you have tried to spawn a broker."
);
}
expected
<
strong_actor_ptr
>
...
...
libcaf_core/caf/actor_system_config.hpp
View file @
d4df45ed
...
...
@@ -275,10 +275,6 @@ public:
/// @private
timespan
stream_tick_duration
()
const
noexcept
;
// -- OpenCL parameters ------------------------------------------------------
std
::
string
opencl_device_ids
;
// -- OpenSSL parameters -----------------------------------------------------
std
::
string
openssl_certificate
;
...
...
libcaf_core/caf/fwd.hpp
View file @
d4df45ed
...
...
@@ -241,14 +241,6 @@ class middleman;
}
// namespace net
// -- OpenCL classes -----------------------------------------------------------
namespace
opencl
{
class
manager
;
}
// namespace opencl
// -- scheduler classes --------------------------------------------------------
namespace
scheduler
{
...
...
libcaf_core/src/actor_system.cpp
View file @
d4df45ed
...
...
@@ -31,9 +31,9 @@
#include "caf/policy/work_sharing.hpp"
#include "caf/policy/work_stealing.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
#include "caf/scheduler/coordinator.hpp"
#include "caf/scheduler/test_coordinator.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
namespace
caf
{
...
...
@@ -87,8 +87,8 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
// also iterate all subscribers for '*'
for
(
auto
&
subscriber
:
self
->
state
.
data
[
wildcard
].
second
)
if
(
subscriber
!=
self
->
current_sender
())
self
->
send
(
actor_cast
<
actor
>
(
subscriber
),
update_atom
::
value
,
key
,
vp
.
first
);
self
->
send
(
actor_cast
<
actor
>
(
subscriber
),
update_atom
::
value
,
key
,
vp
.
first
);
},
// get a key/value pair
[
=
](
get_atom
,
std
::
string
&
key
)
->
message
{
...
...
@@ -101,8 +101,8 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
return
make_message
(
std
::
move
(
msgs
));
}
auto
i
=
self
->
state
.
data
.
find
(
key
);
return
make_message
(
std
::
move
(
key
),
i
!=
self
->
state
.
data
.
end
()
?
i
->
second
.
first
return
make_message
(
std
::
move
(
key
),
i
!=
self
->
state
.
data
.
end
()
?
i
->
second
.
first
:
make_message
());
},
// subscribe to a key
...
...
@@ -137,8 +137,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
// get a 'named' actor from local registry
[
=
](
get_atom
,
atom_value
name
)
{
return
self
->
home_system
().
registry
().
get
(
name
);
}
};
}};
}
// -- spawn server -------------------------------------------------------------
...
...
@@ -155,15 +154,12 @@ const char* spawn_serv_state::name = "spawn_server";
behavior
spawn_serv_impl
(
stateful_actor
<
spawn_serv_state
>*
self
)
{
CAF_LOG_TRACE
(
""
);
return
{
[
=
](
spawn_atom
,
const
std
::
string
&
name
,
message
&
args
,
actor_system
::
mpi
&
xs
)
->
expected
<
strong_actor_ptr
>
{
return
{[
=
](
spawn_atom
,
const
std
::
string
&
name
,
message
&
args
,
actor_system
::
mpi
&
xs
)
->
expected
<
strong_actor_ptr
>
{
CAF_LOG_TRACE
(
CAF_ARG
(
name
)
<<
CAF_ARG
(
args
));
return
self
->
system
().
spawn
<
strong_actor_ptr
>
(
name
,
std
::
move
(
args
),
self
->
context
(),
true
,
&
xs
);
}
};
}};
}
// -- stream server ------------------------------------------------------------
...
...
@@ -204,8 +200,6 @@ const char* actor_system::module::name() const noexcept {
return
"Scheduler"
;
case
middleman
:
return
"Middleman"
;
case
opencl_manager
:
return
"OpenCL Manager"
;
case
openssl_manager
:
return
"OpenSSL Manager"
;
case
network_manager
:
...
...
@@ -377,17 +371,6 @@ io::middleman& actor_system::middleman() {
return
*
reinterpret_cast
<
io
::
middleman
*>
(
clptr
->
subtype_ptr
());
}
bool
actor_system
::
has_opencl_manager
()
const
{
return
modules_
[
module
::
opencl_manager
]
!=
nullptr
;
}
opencl
::
manager
&
actor_system
::
opencl_manager
()
const
{
auto
&
clptr
=
modules_
[
module
::
opencl_manager
];
if
(
!
clptr
)
CAF_RAISE_ERROR
(
"cannot access opencl manager: module not loaded"
);
return
*
reinterpret_cast
<
opencl
::
manager
*>
(
clptr
->
subtype_ptr
());
}
bool
actor_system
::
has_openssl_manager
()
const
{
return
modules_
[
module
::
openssl_manager
]
!=
nullptr
;
}
...
...
libcaf_core/src/actor_system_config.cpp
View file @
d4df45ed
...
...
@@ -18,10 +18,10 @@
#include "caf/actor_system_config.hpp"
#include <limits>
#include <thread>
#include <fstream>
#include <limits>
#include <sstream>
#include <thread>
#include "caf/config.hpp"
#include "caf/config_option.hpp"
...
...
@@ -39,7 +39,7 @@ namespace {
constexpr
const
char
*
default_config_file
=
"caf-application.ini"
;
}
// namespace
anonymous
}
// namespace
actor_system_config
::~
actor_system_config
()
{
// nop
...
...
@@ -75,7 +75,8 @@ actor_system_config::actor_system_config()
.
add
<
bool
>
(
"help,h?"
,
"print help text to STDERR and exit"
)
.
add
<
bool
>
(
"long-help"
,
"print long help text to STDERR and exit"
)
.
add
<
bool
>
(
"dump-config"
,
"print configuration to STDERR and exit"
)
.
add
<
string
>
(
config_file_path
,
"config-file"
,
"set config file (default: caf-application.ini)"
);
.
add
<
string
>
(
config_file_path
,
"config-file"
,
"set config file (default: caf-application.ini)"
);
opt_group
{
custom_options_
,
"stream"
}
.
add
<
timespan
>
(
stream_desired_batch_complexity
,
"desired-batch-complexity"
,
"processing time per batch"
)
...
...
@@ -132,8 +133,6 @@ actor_system_config::actor_system_config()
.
add
<
bool
>
(
"manual-multiplexing"
,
"disables background activity of the multiplexer"
)
.
add
<
size_t
>
(
"workers"
,
"number of deserialization workers"
);
opt_group
(
custom_options_
,
"opencl"
)
.
add
<
std
::
vector
<
size_t
>>
(
"device-ids"
,
"whitelist for OpenCL devices"
);
opt_group
(
custom_options_
,
"openssl"
)
.
add
<
string
>
(
openssl_certificate
,
"certificate"
,
"path to the PEM-formatted certificate file"
)
...
...
@@ -212,7 +211,7 @@ settings actor_system_config::dump_content() const {
put_missing
(
middleman_group
,
"heartbeat-interval"
,
defaults
::
middleman
::
heartbeat_interval
);
put_missing
(
middleman_group
,
"workers"
,
defaults
::
middleman
::
workers
);
// -- open
c
l parameters
// -- open
ss
l parameters
auto
&
openssl_group
=
result
[
"openssl"
].
as_dictionary
();
put_missing
(
openssl_group
,
"certificate"
,
std
::
string
{});
put_missing
(
openssl_group
,
"key"
,
std
::
string
{});
...
...
@@ -265,7 +264,7 @@ struct ini_iter {
}
};
struct
ini_sentinel
{
};
struct
ini_sentinel
{};
bool
operator
!=
(
ini_iter
iter
,
ini_sentinel
)
{
return
!
iter
.
ini
->
fail
();
...
...
@@ -373,8 +372,8 @@ actor_system_config::add_error_category(atom_value x, error_renderer y) {
return
*
this
;
}
actor_system_config
&
actor_system_config
::
set_impl
(
string_view
name
,
config_value
value
)
{
actor_system_config
&
actor_system_config
::
set_impl
(
string_view
name
,
config_value
value
)
{
if
(
name
==
"middleman.app-identifier"
)
{
// TODO: Print a warning with 0.18 and remove this code with 0.19.
value
.
convert_to_list
();
...
...
@@ -415,8 +414,8 @@ std::string actor_system_config::render(const error& err) {
return
"unknown-error"
;
}
std
::
string
actor_system_config
::
render_sec
(
uint8_t
x
,
atom_value
,
const
message
&
xs
)
{
std
::
string
actor_system_config
::
render_sec
(
uint8_t
x
,
atom_value
,
const
message
&
xs
)
{
auto
tmp
=
static_cast
<
sec
>
(
x
);
return
deep_to_string
(
meta
::
type_name
(
"system_error"
),
tmp
,
meta
::
omittable_if_empty
(),
xs
);
...
...
@@ -429,8 +428,8 @@ std::string actor_system_config::render_exit_reason(uint8_t x, atom_value,
meta
::
omittable_if_empty
(),
xs
);
}
std
::
string
actor_system_config
::
render_pec
(
uint8_t
x
,
atom_value
,
const
message
&
xs
)
{
std
::
string
actor_system_config
::
render_pec
(
uint8_t
x
,
atom_value
,
const
message
&
xs
)
{
auto
tmp
=
static_cast
<
pec
>
(
x
);
return
deep_to_string
(
meta
::
type_name
(
"parser_error"
),
tmp
,
meta
::
omittable_if_empty
(),
xs
);
...
...
tools/caf-run.cpp
View file @
d4df45ed
...
...
@@ -19,19 +19,19 @@
#include <unistd.h>
#include <cstdio>
#include <string>
#include <vector>
#include <sstream>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include "caf/all.hpp"
#include "caf/io/all.hpp"
using
namespace
caf
;
using
std
::
cout
;
using
std
::
cerr
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
string
;
using
std
::
vector
;
...
...
@@ -44,18 +44,14 @@ std::string encode_base64(const string& str) {
std
::
string
result
;
// consumes three characters from input
auto
consume
=
[
&
](
const
char
*
i
)
{
int
buf
[]
{
(
i
[
0
]
&
0xfc
)
>>
2
,
((
i
[
0
]
&
0x03
)
<<
4
)
+
((
i
[
1
]
&
0xf0
)
>>
4
),
((
i
[
1
]
&
0x0f
)
<<
2
)
+
((
i
[
2
]
&
0xc0
)
>>
6
),
i
[
2
]
&
0x3f
};
int
buf
[]{(
i
[
0
]
&
0xfc
)
>>
2
,
((
i
[
0
]
&
0x03
)
<<
4
)
+
((
i
[
1
]
&
0xf0
)
>>
4
),
((
i
[
1
]
&
0x0f
)
<<
2
)
+
((
i
[
2
]
&
0xc0
)
>>
6
),
i
[
2
]
&
0x3f
};
for
(
auto
x
:
buf
)
result
+=
base64_tbl
[
x
];
};
// iterate string in chunks of three characters
auto
i
=
str
.
begin
();
for
(
;
std
::
distance
(
i
,
str
.
end
())
>=
3
;
i
+=
3
)
for
(;
std
::
distance
(
i
,
str
.
end
())
>=
3
;
i
+=
3
)
consume
(
&
(
*
i
));
if
(
i
!=
str
.
end
())
{
// "fill" string with 0s
...
...
@@ -73,12 +69,9 @@ class host_desc {
public:
std
::
string
host
;
int
cpu_slots
;
string
opencl_device_ids
;
host_desc
(
std
::
string
host_addr
,
int
slots
,
string
cldevices
)
:
host
(
std
::
move
(
host_addr
)),
cpu_slots
(
slots
),
opencl_device_ids
(
std
::
move
(
cldevices
))
{
:
host
(
std
::
move
(
host_addr
)),
cpu_slots
(
slots
)
{
// nop
}
...
...
@@ -95,15 +88,6 @@ public:
host_desc
hd
;
hd
.
host
=
std
::
move
(
fields
.
front
());
hd
.
cpu_slots
=
0
;
hd
.
opencl_device_ids
=
""
;
for
(
auto
i
=
fields
.
begin
()
+
1
;
i
!=
fields
.
end
();
++
i
)
{
if
(
starts_with
(
*
i
,
"device_ids="
))
{
hd
.
opencl_device_ids
.
assign
(
std
::
find
(
i
->
begin
(),
i
->
end
(),
'='
)
+
1
,
i
->
end
());
}
else
if
(
sscanf
(
i
->
c_str
(),
"slots=%d"
,
&
hd
.
cpu_slots
)
!=
0
)
{
cerr
<<
"invalid option at line "
<<
num
<<
": "
<<
*
i
<<
endl
;
}
}
xs
.
emplace_back
(
std
::
move
(
hd
));
}
...
...
@@ -121,10 +105,10 @@ std::vector<host_desc> read_hostfile(const string& fname) {
return
result
;
}
bool
run_ssh
(
actor_system
&
system
,
const
string
&
wdir
,
const
string
&
cmd
,
const
string
&
host
)
{
std
::
cout
<<
"runssh, wdir: "
<<
wdir
<<
" cmd: "
<<
cmd
<<
" host: "
<<
host
<<
std
::
endl
;
bool
run_ssh
(
actor_system
&
system
,
const
string
&
wdir
,
const
string
&
cmd
,
const
string
&
host
)
{
std
::
cout
<<
"runssh, wdir: "
<<
wdir
<<
" cmd: "
<<
cmd
<<
" host: "
<<
host
<<
std
::
endl
;
// pack command before sending it to avoid any issue with shell escaping
string
full_cmd
=
"cd "
;
full_cmd
+=
wdir
;
...
...
@@ -132,9 +116,9 @@ bool run_ssh(actor_system& system, const string& wdir,
full_cmd
+=
cmd
;
auto
packed
=
encode_base64
(
full_cmd
);
std
::
ostringstream
oss
;
oss
<<
"ssh -Y -o ServerAliveInterval=60 "
<<
host
<<
R"(
"echo )"
<<
packed
<<
R"(
| base64 --decode | /bin/sh")"
;
//return system(oss.str().c_str());
oss
<<
"ssh -Y -o ServerAliveInterval=60 "
<<
host
<<
R"( "echo )"
<<
packed
<<
R"( | base64 --decode | /bin/sh")"
;
//
return system(oss.str().c_str());
string
line
;
std
::
cout
<<
"popen: "
<<
oss
.
str
()
<<
std
::
endl
;
auto
fp
=
popen
(
oss
.
str
().
c_str
(),
"r"
);
...
...
@@ -163,12 +147,9 @@ bool run_ssh(actor_system& system, const string& wdir,
return
true
;
}
void
bootstrap
(
actor_system
&
system
,
const
string
&
wdir
,
const
host_desc
&
master
,
vector
<
host_desc
>
slaves
,
const
string
&
cmd
,
vector
<
string
>
args
)
{
void
bootstrap
(
actor_system
&
system
,
const
string
&
wdir
,
const
host_desc
&
master
,
vector
<
host_desc
>
slaves
,
const
string
&
cmd
,
vector
<
string
>
args
)
{
using
io
::
network
::
interfaces
;
if
(
!
args
.
empty
())
args
.
erase
(
args
.
begin
());
...
...
@@ -184,8 +165,7 @@ void bootstrap(actor_system& system,
auto
port
=
*
port_res
;
// run a slave process at master host if user defined slots > 1 for it
if
(
master
.
cpu_slots
>
1
)
slaves
.
emplace_back
(
master
.
host
,
master
.
cpu_slots
-
1
,
master
.
opencl_device_ids
);
slaves
.
emplace_back
(
master
.
host
,
master
.
cpu_slots
-
1
);
for
(
auto
&
slave
:
slaves
)
{
using
namespace
caf
::
io
::
network
;
// build SSH command and pack it to avoid any issue with shell escaping
...
...
@@ -194,15 +174,13 @@ void bootstrap(actor_system& system,
oss
<<
cmd
;
if
(
slave
.
cpu_slots
>
0
)
oss
<<
" --caf#scheduler.max-threads="
<<
slave
.
cpu_slots
;
if
(
!
slave
.
opencl_device_ids
.
empty
())
oss
<<
" --caf#opencl-devices="
<<
slave
.
opencl_device_ids
;
oss
<<
" --caf#slave-mode"
<<
" --caf#slave-name="
<<
slave
.
host
<<
" --caf#bootstrap-node="
;
bool
is_first
=
true
;
interfaces
::
traverse
(
{
protocol
::
ipv4
,
protocol
::
ipv6
}
,
[
&
](
const
char
*
,
protocol
::
network
,
bool
lo
,
const
char
*
x
)
{
interfaces
::
traverse
({
protocol
::
ipv4
,
protocol
::
ipv6
},
[
&
](
const
char
*
,
protocol
::
network
,
bool
lo
,
const
char
*
x
)
{
if
(
lo
)
return
;
if
(
!
is_first
)
...
...
@@ -215,7 +193,9 @@ void bootstrap(actor_system& system,
oss
<<
" "
<<
arg
;
if
(
!
run_ssh
(
system
,
wdir
,
oss
.
str
(),
slave
.
host
))
anon_send
(
bootstrapper
,
slave
.
host
);
},
actor
{
self
}}.
detach
();
},
actor
{
self
}}
.
detach
();
}
std
::
string
slaveslist
;
for
(
size_t
i
=
0
;
i
<
slaves
.
size
();
++
i
)
{
...
...
@@ -229,8 +209,7 @@ void bootstrap(actor_system& system,
},
[](
const
string
&
node
)
{
cerr
<<
"unable to launch process via SSH at node "
<<
node
<<
endl
;
}
);
});
}
// run (and wait for) master
std
::
ostringstream
oss
;
...
...
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