Skip to content

Commit

Permalink
TIG-3391 Upgrade C++ Driver for Genny (mongodb#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raiden Worley authored Feb 3, 2022
1 parent fcac24b commit e82cfd3
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 30 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
cmake_policy(VERSION 3.13)
cmake_policy(SET CMP0110 OLD)

# NB: this version number is duplicated in
# src/CMakeList.txt, src/gennylib/CMakeLists.txt and src/gennylib/src/version.cpp
Expand Down Expand Up @@ -63,7 +64,7 @@ set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(
Boost
1.68
1.75
REQUIRED
COMPONENTS
filesystem
Expand Down
3 changes: 3 additions & 0 deletions cmake/FindMongoCxx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# limitations under the License.

find_package(libmongocxx REQUIRED)
find_package(libbsoncxx REQUIRED)
include_directories(${LIBMONGOCXX_INCLUDE_DIR})
include_directories(${LIBBSONCXX_INCLUDE_DIR})

# Make a target for bsoncxx
add_library(MongoCxx::bsoncxx SHARED IMPORTED GLOBAL)
Expand Down
18 changes: 9 additions & 9 deletions evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ buildvariants:
tasks:
- name: tg_compile

- name: centos6-perf
display_name: CentOS 6 for Performance
modules: [mongo]
expansions:
distro: rhel62
run_on:
- centos6-perf
tasks:
- name: tg_compile_and_benchmark
# - name: centos6-perf
# display_name: CentOS 6 for Performance
# modules: [mongo]
# expansions:
# distro: rhel62
# run_on:
# - centos6-perf
# tasks:
# - name: tg_compile_and_benchmark


## ⚡️ Tasks ⚡️
Expand Down
1 change: 1 addition & 0 deletions src/gennylib/include/gennylib/parallel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <mutex>
#include <vector>
#include <deque>
#include <sstream>

namespace genny {

Expand Down
2 changes: 1 addition & 1 deletion src/gennylib/test/Node_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ TEST_CASE("YAML::Node Equivalency") {
REQUIRE(bool(yaml[0]) == false);
// ...but it does barf when treating a scalar like a sequence
REQUIRE_THROWS_WITH([&]() { yaml["foo"][0]; }(),
Catch::Matches("operator\\[\\] call on a scalar"));
Catch::Matches("operator\\[\\] call on a scalar \\(key: \"0\"\\)"));
}

{
Expand Down
42 changes: 29 additions & 13 deletions src/lamplib/src/genny/tasks/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,24 @@ def cmake(
# We set both the prefix path and the toolchain file here as a hack to allow cmake
# to find both shared and static libraries. vcpkg doesn't natively support a project
# using both.
cmake_prefix_path = os.path.join(
toolchain_info.toolchain_dir, f"installed/x64-{toolchain_info.triplet_os}-shared",
)
cmake_prefix_paths = [
os.path.join(
toolchain_info.toolchain_dir, f"installed/x64-{toolchain_info.triplet_os}-dynamic",
),
os.path.join(toolchain_info.toolchain_dir, f"installed/x64-{toolchain_info.triplet_os}",),
]

cmake_toolchain_file = os.path.join(
toolchain_info.toolchain_dir, "scripts/buildsystems/vcpkg.cmake"
)

cmake_cmd += [
"-DGENNY_WORKSPACE_ROOT={}".format(workspace_root),
# "-DGENNY_REPO_ROOT={}".format(genny_repo_root), # Not needed (yet).
"-DCMAKE_PREFIX_PATH={}".format(cmake_prefix_path),
"-DCMAKE_PREFIX_PATH={}".format(";".join(cmake_prefix_paths)),
"-DCMAKE_TOOLCHAIN_FILE={}".format(cmake_toolchain_file),
"-DCMAKE_EXPORT_COMPILE_COMMANDS=1",
f"-DVCPKG_TARGET_TRIPLET=x64-{toolchain_info.triplet_os}-static",
f"-DVCPKG_TARGET_TRIPLET=x64-{toolchain_info.triplet_os}",
]

cmake_cmd += _sanitizer_flags(sanitizer)
Expand Down Expand Up @@ -163,14 +167,26 @@ def compile_and_install(
sanitizer=sanitizer,
cmake_args=cmake_args,
)
compile_all(
genny_repo_root=genny_repo_root,
workspace_root=workspace_root,
build_system=build_system,
os_family=os_family,
linux_distro=linux_distro,
ignore_toolchain_version=ignore_toolchain_version,
)

try:
compile_all(
genny_repo_root=genny_repo_root,
workspace_root=workspace_root,
build_system=build_system,
os_family=os_family,
linux_distro=linux_distro,
ignore_toolchain_version=ignore_toolchain_version,
)

except subprocess.CalledProcessError as ex:
SLOG.critical(
"Genny compile has failed. This is sometimes caused by having an old mongodbtoolchain. To update: curl -o toolchain_installer.sh http://mongodbtoolchain.build.10gen.cc/installer.sh && bash toolchain_installer.sh"
)
raise

except:
raise

install(
genny_repo_root=genny_repo_root,
workspace_root=workspace_root,
Expand Down
12 changes: 6 additions & 6 deletions src/lamplib/src/genny/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def _create_compile_environment(

# For cmake and ctest
cmake_bin_relative_dir = {
"linux": "downloads/tools/cmake-3.13.3-linux/cmake-3.13.3-Linux-x86_64/bin",
"osx": "downloads/tools/cmake-3.13.3-osx/cmake-3.13.3-Darwin-x86_64/CMake.app/Contents/bin",
"linux": "downloads/tools/cmake-3.20.2-linux/cmake-3.20.2-linux-x86_64/bin",
"osx": "downloads/tools/cmake-3.20.2-osx/cmake-3.20.2-Darwin-x86_64/CMake.app/Contents/bin",
}[triplet_os]
paths.insert(0, os.path.join(toolchain_dir, cmake_bin_relative_dir))

# For ninja
ninja_bin_dir = os.path.join(
toolchain_dir, "downloads/tools/ninja-1.8.2-{}:".format(triplet_os)
toolchain_dir, "downloads/tools/ninja-1.10.1-{}:".format(triplet_os)
)
paths.insert(0, ninja_bin_dir)

Expand Down Expand Up @@ -157,12 +157,12 @@ class ToolchainDownloader(Downloader):
# These build IDs are from the genny-toolchain Evergreen task.
# https://evergreen.mongodb.com/waterfall/genny-toolchain
# Find a compile task (for any build variant) and modify the URL:
# genny_toolchain_amazon2_t_compile_cf1c50fab5291cd583a5036dc9ade265bca165a3_21_10_20_20_05_26
# => cf1c50fab5291cd583a5036dc9ade265bca165a3_21_10_20_20_05_26
# genny_toolchain_archlinux_t_compile_82eb7c32ad09726f3ef0ddc8d7f24a18b03d9644_21_11_23_16_37_21
# => 82eb7c32ad09726f3ef0ddc8d7f24a18b03d9644_21_11_23_16_37_21
# If we were 💅 we could do the string logic here in python, but we're not that fancy.
#

TOOLCHAIN_BUILD_ID = "cf1c50fab5291cd583a5036dc9ade265bca165a3_21_10_20_20_05_26"
TOOLCHAIN_BUILD_ID = "fc5ec55493f12c0791739e66bd9ffc6db78468e1_22_01_31_16_45_23"
TOOLCHAIN_GIT_HASH = TOOLCHAIN_BUILD_ID.split("_")[0]
TOOLCHAIN_ROOT = "/data/mci" # TODO BUILD-7624 change this to /opt.

Expand Down

0 comments on commit e82cfd3

Please sign in to comment.