Skip to content
Merged
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 .github/workflows/native_sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]
numpy-version: [1.23]
build-config: ["Debug", "Release"]
steps:
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "windows-2022"]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]
numpy-version: [1.23]
steps:
- name: Checkout repo
Expand Down Expand Up @@ -86,12 +86,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-2022]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]
numpy-version: [1.23]
exclude:
# only latest needed for sdist, so exlude others
- os: ubuntu-latest
python-version: "3.9"
# only latest needed for sdist, so exlude all others
- os: ubuntu-latest
python-version: "3.10"
steps:
Expand Down Expand Up @@ -151,7 +149,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "windows-2022"]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]
numpy-version: [1.23, 1.24]
env:
ANACONDA_USER: rtosholdings
Expand Down Expand Up @@ -215,7 +213,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-2022]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]
numpy-version: [1.23, 1.24]
steps:
- name: Checkout repo (sparse)
Expand Down
16 changes: 9 additions & 7 deletions bench/riptide_bench/riptide_bench/bench_logging.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#include "logging/logger.h"
#include "logging/logging.h"

#include <benchmark/benchmark.h>

namespace
{
using namespace riptide::logging;
auto & logg = logger::get();
auto service = get_service();
auto logg = get_logger();

static void bench_logging(benchmark::State & state)
{
Expand All @@ -17,15 +18,15 @@ namespace
{
for (auto i = 0; i < num_logs; i++)
{
logg.log(loglevel::debug, "Thread: {0} log number: {1}", id, i);
logg->log(loglevel::debug, "Thread: {0} log number: {1}", id, i);
}
};

auto consume = [=]()
{
while (logg.active())
while (service->active())
{
auto curr{ logg.receive() };
auto curr{ service->receive() };
if (! curr)
break;

Expand All @@ -34,7 +35,8 @@ namespace
}
};

logg.enable({ .max_size = 1'000'000'000, .level = loglevel::debug });
logg->set_level(loglevel::debug);
service->enable({ .max_size = 1'000'000'000 });

std::thread consumer{ consume };
std::vector<std::thread> threads;
Expand All @@ -49,7 +51,7 @@ namespace
t.join();
}

logg.disable();
service->disable();
consumer.join();
}
}
Expand Down
4 changes: 2 additions & 2 deletions conda_recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# The python and numpy variants are only used for local conda builds.
# They are overridden by the CI scripts.
python:
- 3.9
- 3.11

numpy:
- 1.23
- 1.24

c_compiler:
- vs2022 # [win]
Expand Down
2 changes: 2 additions & 0 deletions extras/sdsfile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(HEADERS
../../src/MathThreads.h
../../src/MathWorker.h
../../src/SDSFile.h
../../src/logging/logging.h
../../src/SharedMemory.h
../../src/ZstdCompress.h)

Expand All @@ -29,6 +30,7 @@ set(SOURCES
../../src/MathThreads.cpp
../../src/MathWorker.cpp
../../src/SDSFile.cpp
../../src/logging/logging.cpp
../../src/SharedMemory.cpp
../../src/ZstdCompress.cpp)

Expand Down
48 changes: 33 additions & 15 deletions extras/sdsfile/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
// dllmain.cpp : Defines the entry point for the DLL application.
#include <stdlib.h>
#include "../../src/CommonInc.h"
#include "../../src/MathWorker.h"
#include "../../src/SDSFile.h"

#include <mutex>
#include <stdlib.h>

//#define LOGGING printf
#define LOGGING(...)

//----------------------------------------------------------------------------------
CMathWorker * g_cMathWorker = new CMathWorker();
bool g_bStarted = false;
CMathWorker * g_cMathWorker = nullptr; //new CMathWorker();

namespace
{
// Starting working threads requires thread synchronization, so it cannot be
// called from DllMain or from static object.
// Each API needs to call ensure_threads_started() to ensure that threads have been
// started prior to continuing.

std::once_flag g_bStarted{};

void ensure_threads_started()
{
std::call_once(g_bStarted,
[]()
{
g_cMathWorker = new CMathWorker();
g_cMathWorker->StartWorkerThreads(0);
});
}
}

static int64_t g_TotalAllocs = 0;
static int64_t g_TotalFree = 0;
Expand Down Expand Up @@ -140,18 +161,10 @@ uint64_t GetUTCNanos()
#if defined(_WIN32)
bool APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
// NOTE: Cannot do any thread-related work in DllMain.
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:

if (! g_bStarted)
{
g_bStarted = true;

// default to numa node 0
g_cMathWorker->StartWorkerThreads(0);
}
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
Expand Down Expand Up @@ -419,6 +432,8 @@ extern "C"
// pointer to stReadSharedMemory
RT_DLLEXPORT stReadSharedMemory * ReadFromSharedMemory(const char * fileName, const char * shareName)
{
ensure_threads_started();

// uint64_t fileNameSize;
// uint64_t shareNameSize = 0;

Expand Down Expand Up @@ -815,6 +830,8 @@ extern "C"
const char * inListNames, // use commas to separate
int64_t totalRows, int64_t bandSize = 0)
{
ensure_threads_started();

bool result = CreateSDSFileInternal(fileName, shareName, metaData,
inListNames, // use commas to separate
totalRows, bandSize);
Expand All @@ -829,10 +846,11 @@ extern "C"
// shareName: the sharename the user provided, may be NULL
// Returns:
// true/false
RT_DLLEXPORT bool AppendSDSFile(const char * outFileName,

const char * shareFileName, const char * shareName, int64_t totalRows, int64_t bandSize = 0)
RT_DLLEXPORT bool AppendSDSFile(const char * outFileName, const char * shareFileName, const char * shareName,
int64_t totalRows, int64_t bandSize = 0)
{
ensure_threads_started();

stReadSharedMemory * pSharedMemory = (stReadSharedMemory *)ReadFromSharedMemory(shareFileName, shareName);
if (pSharedMemory)
{
Expand Down
7 changes: 1 addition & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ description = "Python Package with fast math util functions"
readme = "README.md"
license = { file = "LICENSE" }
authors = [{ name = "RTOS Holdings", email = "rtosholdings-bot@sig.com" }]
requires-python = ">=3.9"
requires-python = ">=3.10"
dynamic = ["version"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: BSD License",
Expand Down Expand Up @@ -87,10 +86,6 @@ cmake.args = [
]

# Static way of passing current Python version to CMake.
[[tool.scikit-build.overrides]]
if.python-version = "~=3.9"
cmake.define = { "RIPTIDE_PYTHON_VER" = "3.9" }

[[tool.scikit-build.overrides]]
if.python-version = "~=3.10"
cmake.define = { "RIPTIDE_PYTHON_VER" = "3.10" }
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set(HEADERS
Hook.h
is_member_tg.h
Logger.h
logging/logging.h
MathThreads.h
MathWorker.h
Merge.h
Expand Down Expand Up @@ -54,6 +55,7 @@ set(SOURCES
Hook.cpp
is_member_tg.cpp
Logger.cpp
logging/logging.cpp
MathThreads.cpp
MathWorker.cpp
Merge.cpp
Expand Down
Loading