Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boinc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
boinc
Commits
ca85ef57
Unverified
Commit
ca85ef57
authored
2 months ago
by
Vitalii Koshura
Committed by
GitHub
2 months ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #6147 from BOINC/dpa_docker_wrapper4
docker_wrapper: support HTML graphics
parents
2e6b3a24
6920f637
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
samples/docker_wrapper/Makefile
+5
-0
5 additions, 0 deletions
samples/docker_wrapper/Makefile
samples/docker_wrapper/docker_wrapper.cpp
+36
-0
36 additions, 0 deletions
samples/docker_wrapper/docker_wrapper.cpp
win_build/docker_wrapper.vcxproj
+1
-0
1 addition, 0 deletions
win_build/docker_wrapper.vcxproj
with
42 additions
and
0 deletions
samples/docker_wrapper/Makefile
+
5
−
0
View file @
ca85ef57
...
@@ -31,6 +31,11 @@ ifdef BUILD_APPS_WITH_VCPKG
...
@@ -31,6 +31,11 @@ ifdef BUILD_APPS_WITH_VCPKG
-L
$(
VCPKG_DIR
)
/lib
-L
$(
VCPKG_DIR
)
/lib
endif
endif
ifdef
BUILD_WITH_MINGW
MAKEFILE_LDFLAGS
+=
\
-lws2_32
endif
all
:
docker_wrapper
all
:
docker_wrapper
libstdc++.a
:
libstdc++.a
:
...
...
This diff is collapsed.
Click to expand it.
samples/docker_wrapper/docker_wrapper.cpp
+
36
−
0
View file @
ca85ef57
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
// docker_wrapper: run a BOINC job in a Docker container,
// docker_wrapper: run a BOINC job in a Docker container,
// and interface between the BOINC client and the container
// and interface between the BOINC client and the container
// See https://github.com/BOINC/boinc/wiki/Docker-apps#the-docker-wrapper
//
//
// docker_wrapper [options] arg1 arg2 ...
// docker_wrapper [options] arg1 arg2 ...
// options:
// options:
...
@@ -92,6 +93,7 @@
...
@@ -92,6 +93,7 @@
#include
"util.h"
#include
"util.h"
#include
"boinc_api.h"
#include
"boinc_api.h"
#include
"network.h"
#ifdef _WIN32
#ifdef _WIN32
#include
"win_util.h"
#include
"win_util.h"
...
@@ -128,6 +130,10 @@ struct CONFIG {
...
@@ -128,6 +130,10 @@ struct CONFIG {
// use this as the image name, and don't delete it when done.
// use this as the image name, and don't delete it when done.
// For testing.
// For testing.
bool
use_gpu
;
bool
use_gpu
;
// tell Docker to enable GPU access
int
web_graphics_guest_port
;
// map this to a host port,
// and inform the client using boinc_web_graphics_url()
vector
<
string
>
mounts
;
vector
<
string
>
mounts
;
// -v args in create container
// -v args in create container
vector
<
string
>
portmaps
;
vector
<
string
>
portmaps
;
...
@@ -141,6 +147,11 @@ struct CONFIG {
...
@@ -141,6 +147,11 @@ struct CONFIG {
fprintf
(
stderr
,
" project dir mounted at: %s
\n
"
,
project_dir_mount
.
c_str
());
fprintf
(
stderr
,
" project dir mounted at: %s
\n
"
,
project_dir_mount
.
c_str
());
}
}
fprintf
(
stderr
,
" use GPU: %s
\n
"
,
use_gpu
?
"yes"
:
"no"
);
fprintf
(
stderr
,
" use GPU: %s
\n
"
,
use_gpu
?
"yes"
:
"no"
);
if
(
web_graphics_guest_port
)
{
fprintf
(
stderr
,
" Web graphics guest port: %d
\n
"
,
web_graphics_guest_port
);
}
for
(
string
&
s
:
mounts
)
{
for
(
string
&
s
:
mounts
)
{
fprintf
(
stderr
,
" mount: %s
\n
"
,
s
.
c_str
());
fprintf
(
stderr
,
" mount: %s
\n
"
,
s
.
c_str
());
}
}
...
@@ -202,6 +213,11 @@ int parse_config_file() {
...
@@ -202,6 +213,11 @@ int parse_config_file() {
config
.
use_gpu
=
x
->
as
<
bool
>
();
config
.
use_gpu
=
x
->
as
<
bool
>
();
}
}
x
=
v
.
find
(
"web_graphics_guest_port"
);
if
(
x
)
{
config
.
web_graphics_guest_port
=
x
->
as
<
int
>
();
}
x
=
v
.
find
(
"mount"
);
x
=
v
.
find
(
"mount"
);
if
(
x
)
{
if
(
x
)
{
const
toml
::
Array
&
ar
=
x
->
as
<
toml
::
Array
>
();
const
toml
::
Array
&
ar
=
x
->
as
<
toml
::
Array
>
();
...
@@ -373,6 +389,26 @@ int create_container() {
...
@@ -373,6 +389,26 @@ int create_container() {
strcat
(
cmd
,
" --gpus all"
);
strcat
(
cmd
,
" --gpus all"
);
}
}
// web graphics
//
if
(
config
.
web_graphics_guest_port
)
{
int
host_port
;
retval
=
boinc_get_port
(
false
,
host_port
);
if
(
retval
)
{
fprintf
(
stderr
,
"can't allocated host port for web graphics
\n
"
);
}
else
{
fprintf
(
stderr
,
"web graphics: host port %d, guest port %d
\n
"
,
host_port
,
config
.
web_graphics_guest_port
);
snprintf
(
buf
,
sizeof
(
buf
),
" -p %d:%d"
,
host_port
,
config
.
web_graphics_guest_port
);
strcat
(
cmd
,
buf
);
snprintf
(
buf
,
sizeof
(
buf
),
"http://localhost:%d"
,
host_port
);
boinc_web_graphics_url
(
buf
);
}
}
strcat
(
cmd
,
" "
);
strcat
(
cmd
,
" "
);
strcat
(
cmd
,
image_name
);
strcat
(
cmd
,
image_name
);
retval
=
docker_conn
.
command
(
cmd
,
out
);
retval
=
docker_conn
.
command
(
cmd
,
out
);
...
...
This diff is collapsed.
Click to expand it.
win_build/docker_wrapper.vcxproj
+
1
−
0
View file @
ca85ef57
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
<PreprocessorDefinitions>
_CONSOLE;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<PreprocessorDefinitions>
_CONSOLE;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
</ClCompile>
</ClCompile>
<Link>
<Link>
<AdditionalDependencies>
ws2_32.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalDependencies
Condition=
"'$(Configuration)'=='Debug'"
>
libcmtd.lib;libcpmtd.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalDependencies
Condition=
"'$(Configuration)'=='Debug'"
>
libcmtd.lib;libcpmtd.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalDependencies
Condition=
"'$(Configuration)'=='Release'"
>
libcmt.lib;libcpmt.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<AdditionalDependencies
Condition=
"'$(Configuration)'=='Release'"
>
libcmt.lib;libcpmt.lib;%(AdditionalDependencies)
</AdditionalDependencies>
<SubSystem>
Console
</SubSystem>
<SubSystem>
Console
</SubSystem>
...
...
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