Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .current_gitmodules

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exaudfclient/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build:benchmark --define benchmark=true
build:r --define r=true
build:java --define java=true --action_env=JAVA_PREFIX
build:python --define python=true --action_env=NUMPY_PREFIX --action_env=PYTHON3_SYSPATH --action_env=PYTHON3_PREFIX --action_env=PYTHON3_VERSION
build:fast-binary --copt='-DCUSTOM_LIBEXAUDFLIB_PATH="/exaudf/base/libexaudflib_complete.so"' --define binary_type=fast_binary //:exaudfclient
build:fast-binary --define binary_type=fast_binary //:exaudfclient
build:slow-wrapper --define binary_type=slow_wrapper //:exaudfclient
build:static-binary //:exaudfclient_static
build:test-binaries --config=static-binary --config=slow-wrapper
Expand Down
117 changes: 36 additions & 81 deletions exaudfclient/BUILD
Original file line number Diff line number Diff line change
@@ -1,80 +1,24 @@
load("//:variables.bzl", "VM_ENABLED_DEFINES")

config_setting(
name = "benchmark",
define_values = {"benchmark": "true"},
)

config_setting(
name = "python",
define_values = {"python": "true"},
)

config_setting(
name = "java",
define_values = {"java": "true"},
)

config_setting(
name = "bash",
define_values = {"bash": "true"},
)

config_setting(
name = "r",
define_values = {"r": "true"},
)

config_setting(
name = "fast_binary",
define_values = {
"binary_type": "fast_binary",
},
)

config_setting(
name = "slow_wrapper",
define_values = {
"binary_type": "slow_wrapper",
},
)


config_setting(
name = "valgrind_wrapper",
define_values = {
"wrapper_type": "valgrind_wrapper",
},
)

config_setting(
name = "valgrind_massif_wrapper",
define_values = {
"wrapper_type": "valgrind_massif_wrapper",
},
)

config_setting(
name = "stdout_to_bucketfs",
define_values = {
"wrapper_type": "stdout_to_bucketfs",
},
)


VM_ENABLED_DEPS=select({
"//:benchmark": ["//base/benchmark_container:benchmark_container"],
"@exaudfclient_base//:benchmark": ["@exaudfclient_base//benchmark_container:benchmark_container"],
"//conditions:default": []
}) + select({
"//:java": ["//base/javacontainer:javacontainer"],
"@exaudfclient_base//:java": ["@exaudfclient_base//javacontainer:javacontainer"],
"//conditions:default": []
}) + select({
"//:bash": ["//base/streaming_container:streamingcontainer"],
"@exaudfclient_base//:bash": ["@exaudfclient_base//streaming_container:streamingcontainer"],
"//conditions:default": []
})

VM_PYTHON3_DEPS=select({
"//:python": ["//base/python/python3:pythoncontainer"],
"@exaudfclient_base//:python": ["@exaudfclient_base//python/python3:pythoncontainer"],
"//conditions:default": []
})

Expand All @@ -85,14 +29,25 @@ VM_R_DEPS=select({
})


genrule(
name = "exaudflib_output_path_header",
srcs = ["@exaudfclient_base//:libexaudflib_complete.so"],
outs = ["exaudf_lib_output_path.h"],
cmd = '''
echo "#define CUSTOM_LIBEXAUDFLIB_PATH \\"/exaudf/external/$(rlocationpath @exaudfclient_base//:libexaudflib_complete.so)\\"" > $@
''',
)



cc_binary(
name = "exaudfclient_bin",
srcs = ["exaudfclient.cc", "//base:load_dynamic"],
srcs = ["exaudfclient.cc", "@exaudfclient_base//:load_dynamic", "//:exaudflib_output_path_header"],
linkopts = ["-ldl"], # needed for dynamicly loading libexaudflib_complete.so into another linker namespace
deps = ["//base/exaudflib:header", "//base/utils:utils"]+VM_ENABLED_DEPS+VM_PYTHON3_DEPS+VM_R_DEPS+
["//base/exaudflib:exaudflib-deps"],
deps = ["@exaudfclient_base//exaudflib:header", "@exaudfclient_base//utils:utils"]+VM_ENABLED_DEPS+VM_PYTHON3_DEPS+VM_R_DEPS+
["@exaudfclient_base//exaudflib:exaudflib-deps"],
defines = VM_ENABLED_DEFINES,
data = ["//base:libexaudflib_complete.so"]
data = ["@exaudfclient_base//:libexaudflib_complete.so"]
)

## The purpose of the static binaries is to verify if the linker namespace test work correctly.
Expand All @@ -104,18 +59,18 @@ cc_binary(
## Besides this the test under test/python3/all/linker_namespace.py checks the normal build, which expects
## not to find any occurence of the dependencies (protobuf/zmq) in the primary linker namespace.
##
## We need to explicitly declare the dependency of protobuf/zmq here, as the exaudflib is a static lib (//base/exaudflib:exaudflib)
## We need to explicitly declare the dependency of protobuf/zmq here, as the exaudflib is a static lib (@exaudfclient_base//exaudflib:exaudflib)
## and hence does not contain dependency information. We cannot declare the shared lib (:exaudflib_complete.so)
## as dependency as it is a binary for bazel.

cc_binary(
name = "exaudfclient_static_bin",
srcs = ["exaudfclient.cc", "//base:load_dynamic"],
srcs = ["exaudfclient.cc", "@exaudfclient_base//:load_dynamic", "//:exaudflib_output_path_header"],
linkopts = ["-ldl"], # needed for dynamicly loading libexaudflib_complete.so into another linker namespace
deps = ["//base/exaudflib:header", "//base/utils:utils"]+VM_ENABLED_DEPS+VM_PYTHON3_DEPS+VM_R_DEPS+
["//base/exaudflib:exaudflib-deps"] + [ "@zmq//:zmq", "@protobuf//:protobuf"],
deps = ["@exaudfclient_base//exaudflib:header", "@exaudfclient_base//utils:utils"]+VM_ENABLED_DEPS+VM_PYTHON3_DEPS+VM_R_DEPS+
["@exaudfclient_base//exaudflib:exaudflib-deps"] + [ "@zmq//:zmq", "@protobuf//:protobuf"],
defines = VM_ENABLED_DEFINES,
data = ["//base:libexaudflib_complete.so"],
data = ["@exaudfclient_base//:libexaudflib_complete.so"],
)

# Workarround for the hardcoded paths in exaudfclient for libexaudflib_complete.so and python_ext_dataframe.cc
Expand All @@ -129,41 +84,41 @@ cc_binary(
sh_library(
name = "wrapper_generator_bin",
srcs=select({
"//:valgrind_wrapper": ["//base:create_binary_wrapper_valgrind.sh"],
"//:valgrind_massif_wrapper": ["//base:create_binary_wrapper_valgrind_massif.sh"],
"//:stdout_to_bucketfs": ["//base:create_binary_wrapper_stdout_to_bucketfs.sh"],
"//conditions:default": ["//base:create_binary_wrapper.sh"]
"@exaudfclient_base//:valgrind_wrapper": ["@exaudfclient_base//:create_binary_wrapper_valgrind.sh"],
"@exaudfclient_base//:valgrind_massif_wrapper": ["@exaudfclient_base//:create_binary_wrapper_valgrind_massif.sh"],
"@exaudfclient_base//:stdout_to_bucketfs": ["@exaudfclient_base//:create_binary_wrapper_stdout_to_bucketfs.sh"],
"//conditions:default": ["@exaudfclient_base//:create_binary_wrapper.sh"]
})
)


SLOW_WRAPPER_BINARY="""$(location //:wrapper_generator_bin) "$(location exaudfclient_bin)" "$(location exaudfclient)" "$(location //base:exaudfclient.template.sh)" """
SLOW_WRAPPER_BINARY="""$(location //:wrapper_generator_bin) "$(location exaudfclient_bin)" "$(location exaudfclient)" "$(location @exaudfclient_base//:exaudfclient.template.sh)" """
FAST_BINARY="""cp "$(location exaudfclient_bin)" "$(location exaudfclient)" """
CREATE_BINARY_SCRIPT=select({
"//:fast_binary": FAST_BINARY,
"//:slow_wrapper": SLOW_WRAPPER_BINARY,
"@exaudfclient_base//:fast_binary": FAST_BINARY,
"@exaudfclient_base//:slow_wrapper": SLOW_WRAPPER_BINARY,
"//conditions:default": FAST_BINARY
})
genrule(
name = "exaudfclient",
cmd = CREATE_BINARY_SCRIPT,
outs = ["exaudfclient"],
srcs = [":exaudfclient_bin", "//base:libexaudflib_complete.so", "//base:exaudfclient.template.sh", "//:wrapper_generator_bin"],
srcs = [":exaudfclient_bin", "@exaudfclient_base//:libexaudflib_complete.so", "@exaudfclient_base//:exaudfclient.template.sh", "//:wrapper_generator_bin"],
output_to_bindir = True
)

SLOW_WRAPPER_STATIC_BINARY="""$(location //:wrapper_generator_bin) "$(location exaudfclient_static_bin)" "$(location exaudfclient_static)" "$(location //base:exaudfclient.template.sh)" """
SLOW_WRAPPER_STATIC_BINARY="""$(location //:wrapper_generator_bin) "$(location exaudfclient_static_bin)" "$(location exaudfclient_static)" "$(location @exaudfclient_base//:exaudfclient.template.sh)" """
FAST_BINARY_STATIC="""cp "$(location exaudfclient_static_bin)" "$(location exaudfclient_static)" """
CREATE_STATIC_BINARY_SCRIPT=select({
"//:fast_binary": FAST_BINARY_STATIC,
"//:slow_wrapper": SLOW_WRAPPER_STATIC_BINARY,
"@exaudfclient_base//:fast_binary": FAST_BINARY_STATIC,
"@exaudfclient_base//:slow_wrapper": SLOW_WRAPPER_STATIC_BINARY,
"//conditions:default": FAST_BINARY_STATIC
})

genrule(
name = "exaudfclient_static",
cmd = CREATE_STATIC_BINARY_SCRIPT,
outs = ["exaudfclient_static"],
srcs = [":exaudfclient_static_bin", "//base:libexaudflib_complete.so", "//base:exaudfclient.template.sh", "//:wrapper_generator_bin"],
srcs = [":exaudfclient_static_bin", "@exaudfclient_base//:libexaudflib_complete.so", "@exaudfclient_base//:exaudfclient.template.sh", "//:wrapper_generator_bin"],
output_to_bindir = True
)
10 changes: 8 additions & 2 deletions exaudfclient/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
module(name="exaudfclient_ext", version = "1.0")

include("//base:base.MODULE.bazel")

bazel_dep(name = "exaudfclient_base", version = "1.0.0")
local_path_override(module_name="exaudfclient_base", path="base")

new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")

zmq_local_repository = use_repo_rule("@exaudfclient_base//:zmq_repository.bzl", "zmq_local_repository")
zmq_local_repository(name = "zmq")

protobuf_local_repository = use_repo_rule("@exaudfclient_base//:protobuf_repository.bzl", "protobuf_local_repository")
protobuf_local_repository(name = "protobuf")

new_local_repository(
name = "R_linux",
path = "/usr",
Expand Down
17 changes: 10 additions & 7 deletions exaudfclient/exaudfclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,26 @@
#include <fstream>
#include <link.h>
#include <string.h>

#include "exaudf_lib_output_path.h"

#ifndef UDF_PLUGIN_CLIENT
#include <dlfcn.h>
#endif
#include <exception>
#include "base/exaudflib/vm/swig_vm.h"
#include "base/exaudflib/load_dynamic.h"
#include "exaudflib/vm/swig_vm.h"
#include "exaudflib/load_dynamic.h"
#ifdef ENABLE_R_VM
#include "rcontainer/rcontainer.h"
#endif
#ifdef ENABLE_BENCHMARK_VM
#include "base/benchmark_container/benchmark_container.h"
#include "benchmark_container/benchmark_container.h"
#endif
#ifdef ENABLE_STREAMING_VM
#include "base/streaming_container/streamingcontainer.h"
#include "streaming_container/streamingcontainer.h"
#endif
#include <functional>
#include "base/utils/debug_message.h"
#include "utils/debug_message.h"
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
Expand All @@ -40,11 +43,11 @@


#ifdef ENABLE_JAVA_VM
#include "base/javacontainer/javacontainer_builder.h"
#include "javacontainer/javacontainer_builder.h"
#endif //ENABLE_JAVA_VM

#ifdef ENABLE_PYTHON_VM
#include "base/python/pythoncontainer.h"
#include "python/pythoncontainer.h"
#endif //ENABLE_PYTHON_VM

#ifdef UDF_PLUGIN_CLIENT
Expand Down
24 changes: 12 additions & 12 deletions exaudfclient/rcontainer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,55 @@ genrule(
name = "exascript_r_tmp_cc",
cmd = """
mkdir -p build_exascript_r_tmp_cc/exaudflib
cp "$(location //base/exaudflib:swig/script_data_transfer_objects_wrapper.h)" "$(location //base/exaudflib:exascript.i)" build_exascript_r_tmp_cc/exaudflib
cp "$(location @exaudfclient_base//exaudflib:swig/script_data_transfer_objects_wrapper.h)" "$(location @exaudfclient_base//exaudflib:exascript.i)" build_exascript_r_tmp_cc/exaudflib
cd build_exascript_r_tmp_cc
swig -v -O -DEXTERNAL_PROCESS -Wall -c++ -r -addextern -module exascript_r -o "../$(location exascript_r_tmp.cc)" exaudflib/exascript.i
""",
outs = ["exascript_r_tmp.cc","exascript_r.R"],
srcs = ["//base/exaudflib:exascript.i","//base/exaudflib:swig/script_data_transfer_objects_wrapper.h"]
srcs = ["@exaudfclient_base//exaudflib:exascript.i","@exaudfclient_base//exaudflib:swig/script_data_transfer_objects_wrapper.h"]
)

genrule(
name = "exascript_r_tmp_h",
cmd = """
mkdir build_exascript_r_tmp_h
cp "$(location //base/exaudflib:swig/script_data_transfer_objects_wrapper.h)" "$(location //base/exaudflib:exascript.i)" build_exascript_r_tmp_h
cp "$(location @exaudfclient_base//exaudflib:swig/script_data_transfer_objects_wrapper.h)" "$(location @exaudfclient_base//exaudflib:exascript.i)" build_exascript_r_tmp_h
cp "$(location exascript_r_tmp.cc)" "$(location exascript_r.R)" build_exascript_r_tmp_h
cd build_exascript_r_tmp_h
swig -DEXTERNAL_PROCESS -c++ -r -external-runtime "../$(location exascript_r_tmp.h)"
""",
outs = ["exascript_r_tmp.h"],
srcs = ["//base/exaudflib:exascript.i","//base/exaudflib:swig/script_data_transfer_objects_wrapper.h", ":exascript_r_tmp.cc", ":exascript_r.R"]
srcs = ["@exaudfclient_base//exaudflib:exascript.i","@exaudfclient_base//exaudflib:swig/script_data_transfer_objects_wrapper.h", ":exascript_r_tmp.cc", ":exascript_r.R"]
)

genrule(
name = "exascript_r_int",
cmd = """
cp $(locations :exascript_r_tmp_cc) $(location exascript_r_wrap.R) $(location exascript_r_preset.R) . &&
python3 $(location //base:build_integrated.py) "$(location exascript_r_int.h)" exascript_r.R"" "exascript_r_wrap.R" "exascript_r_preset.R"
python3 $(location @exaudfclient_base//:build_integrated.py) "$(location exascript_r_int.h)" exascript_r.R"" "exascript_r_wrap.R" "exascript_r_preset.R"
""",
outs = ["exascript_r_int.h"],
srcs = ["exascript_r_wrap.R", "exascript_r_preset.R", ":exascript_r_tmp_cc"],
tools = ["//base:build_integrated.py"]
tools = ["@exaudfclient_base//:build_integrated.py"]
)

genrule(
name = "filter_swig_code_exascript_r_h",
cmd = 'python3 $(location //base:filter_swig_code.py) "$@" "$<"',
cmd = 'python3 $(location @exaudfclient_base//:filter_swig_code.py) "$@" "$<"',
outs = ["exascript_r.h"],
srcs = [":exascript_r_tmp_h"],
tools = ["//base:filter_swig_code.py"]
tools = ["@exaudfclient_base//:filter_swig_code.py"]
)

genrule(
name = "filter_swig_code_exascript_r_cc",
cmd = """
cp $(locations :exascript_r_tmp_cc) .
python3 $(location //base:filter_swig_code.py) "$@" "exascript_r_tmp.cc"
python3 $(location @exaudfclient_base//:filter_swig_code.py) "$@" "exascript_r_tmp.cc"
""",
outs = ["exascript_r.cc"],
srcs = [":exascript_r_tmp_cc"],
tools = ["//base:filter_swig_code.py"]
tools = ["@exaudfclient_base//:filter_swig_code.py"]
)

config_setting(
Expand All @@ -72,7 +72,7 @@ cc_library(
srcs = [":filter_swig_code_exascript_r_cc",":filter_swig_code_exascript_r_h"],
hdrs = [":filter_swig_code_exascript_r_h"],
copts = ["-DENABLE_R_VM"]+optimize_copts,
deps = ["@R_linux//:r-lib","//base/exaudflib:exaudflib-deps","//base/exaudflib:header"],
deps = ["@R_linux//:r-lib","@exaudfclient_base//exaudflib:exaudflib-deps","@exaudfclient_base//exaudflib:header"],
alwayslink = True,
)

Expand All @@ -83,6 +83,6 @@ cc_library(
include_prefix = ".",
data = ["exascript_r_wrap.R", "exascript_r_preset.R"], #TODO do we need this, because build_integreted
hdrs = ["filter_swig_code_exascript_r_h","exascript_r_int", "rcontainer.h"],
deps = ["@R_linux//:r-lib",":exascript_r","//base/exaudflib:header"],
deps = ["@R_linux//:r-lib",":exascript_r","@exaudfclient_base//exaudflib:header"],
alwayslink = True,
)
2 changes: 1 addition & 1 deletion exaudfclient/rcontainer/rcontainer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <R_ext/Boolean.h>
#include "exascript_r.h"
#include "exascript_r_int.h"
#include "base/exaudflib/swig/swig_result_handler.h"
#include "exaudflib/swig/swig_result_handler.h"

using namespace SWIGVMContainers;
using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion exaudfclient/rcontainer/rcontainer.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef RCONTAINER_H
#define RCONTAINER_H

#include "base/exaudflib/vm/swig_vm.h"
#include "exaudflib/vm/swig_vm.h"


using namespace SWIGVMContainers;
Expand Down
13 changes: 7 additions & 6 deletions exaudfclient/variables.bzl
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
BENCHMARK_VM_ENABLED_DEFINE=select({
"//:benchmark": ["ENABLE_BENCHMARK_VM"],
"@exaudfclient_base//:benchmark": ["ENABLE_BENCHMARK_VM"],
"//conditions:default": []
})
})
STREAMING_VM_ENABLED_DEFINE=select({
"//:bash": ["ENABLE_STREAMING_VM"],
"@exaudfclient_base//:bash": ["ENABLE_STREAMING_VM"],
"//conditions:default": []
})
})
PYTHON_VM_ENABLED_DEFINE=select({
"//:python": ["ENABLE_PYTHON_VM"],
"@exaudfclient_base//:python": ["ENABLE_PYTHON_VM"],
"//conditions:default": []
})
JAVA_VM_ENABLED_DEFINE=select({
"//:java": ["ENABLE_JAVA_VM"],
"@exaudfclient_base//:java": ["ENABLE_JAVA_VM"],
"//conditions:default": []
})

R_VM_ENABLED_DEFINE=select({
"//:r": ["ENABLE_R_VM"],
"//conditions:default": []
Expand Down
Loading
Loading