Skip to content

Commit e268556

Browse files
Merge pull request #171 from rtosholdings/latest-v1.18.0
v1.18.0
2 parents 81d0cff + 1f1029e commit e268556

32 files changed

Lines changed: 1781 additions & 728 deletions

.github/workflows/native_sanity.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
matrix:
2323
os: [ubuntu-latest, windows-latest]
24-
python-version: ["3.9", "3.10", "3.11"]
24+
python-version: ["3.10", "3.11"]
2525
numpy-version: [1.23]
2626
build-config: ["Debug", "Release"]
2727
steps:

.github/workflows/python_package.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
matrix:
2222
os: ["ubuntu-latest", "windows-2022"]
23-
python-version: ["3.9", "3.10", "3.11"]
23+
python-version: ["3.10", "3.11"]
2424
numpy-version: [1.23]
2525
steps:
2626
- name: Checkout repo
@@ -86,12 +86,10 @@ jobs:
8686
strategy:
8787
matrix:
8888
os: [ubuntu-latest, windows-2022]
89-
python-version: ["3.9", "3.10", "3.11"]
89+
python-version: ["3.10", "3.11"]
9090
numpy-version: [1.23]
9191
exclude:
92-
# only latest needed for sdist, so exlude others
93-
- os: ubuntu-latest
94-
python-version: "3.9"
92+
# only latest needed for sdist, so exlude all others
9593
- os: ubuntu-latest
9694
python-version: "3.10"
9795
steps:
@@ -151,7 +149,7 @@ jobs:
151149
strategy:
152150
matrix:
153151
os: ["ubuntu-latest", "windows-2022"]
154-
python-version: ["3.9", "3.10", "3.11"]
152+
python-version: ["3.10", "3.11"]
155153
numpy-version: [1.23, 1.24]
156154
env:
157155
ANACONDA_USER: rtosholdings
@@ -215,7 +213,7 @@ jobs:
215213
strategy:
216214
matrix:
217215
os: [ubuntu-latest, windows-2022]
218-
python-version: ["3.9", "3.10", "3.11"]
216+
python-version: ["3.10", "3.11"]
219217
numpy-version: [1.23, 1.24]
220218
steps:
221219
- name: Checkout repo (sparse)

bench/riptide_bench/riptide_bench/bench_logging.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
#include "logging/logger.h"
1+
#include "logging/logging.h"
22

33
#include <benchmark/benchmark.h>
44

55
namespace
66
{
77
using namespace riptide::logging;
8-
auto & logg = logger::get();
8+
auto service = get_service();
9+
auto logg = get_logger();
910

1011
static void bench_logging(benchmark::State & state)
1112
{
@@ -17,15 +18,15 @@ namespace
1718
{
1819
for (auto i = 0; i < num_logs; i++)
1920
{
20-
logg.log(loglevel::debug, "Thread: {0} log number: {1}", id, i);
21+
logg->log(loglevel::debug, "Thread: {0} log number: {1}", id, i);
2122
}
2223
};
2324

2425
auto consume = [=]()
2526
{
26-
while (logg.active())
27+
while (service->active())
2728
{
28-
auto curr{ logg.receive() };
29+
auto curr{ service->receive() };
2930
if (! curr)
3031
break;
3132

@@ -34,7 +35,8 @@ namespace
3435
}
3536
};
3637

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

3941
std::thread consumer{ consume };
4042
std::vector<std::thread> threads;
@@ -49,7 +51,7 @@ namespace
4951
t.join();
5052
}
5153

52-
logg.disable();
54+
service->disable();
5355
consumer.join();
5456
}
5557
}

conda_recipe/conda_build_config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# The python and numpy variants are only used for local conda builds.
22
# They are overridden by the CI scripts.
33
python:
4-
- 3.9
4+
- 3.11
55

66
numpy:
7-
- 1.23
7+
- 1.24
88

99
c_compiler:
1010
- vs2022 # [win]

extras/sdsfile/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ set(HEADERS
2020
../../src/MathThreads.h
2121
../../src/MathWorker.h
2222
../../src/SDSFile.h
23+
../../src/logging/logging.h
2324
../../src/SharedMemory.h
2425
../../src/ZstdCompress.h)
2526

@@ -29,6 +30,7 @@ set(SOURCES
2930
../../src/MathThreads.cpp
3031
../../src/MathWorker.cpp
3132
../../src/SDSFile.cpp
33+
../../src/logging/logging.cpp
3234
../../src/SharedMemory.cpp
3335
../../src/ZstdCompress.cpp)
3436

extras/sdsfile/dllmain.cpp

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
11
// dllmain.cpp : Defines the entry point for the DLL application.
2-
#include <stdlib.h>
32
#include "../../src/CommonInc.h"
43
#include "../../src/MathWorker.h"
54
#include "../../src/SDSFile.h"
65

6+
#include <mutex>
7+
#include <stdlib.h>
8+
79
//#define LOGGING printf
810
#define LOGGING(...)
911

1012
//----------------------------------------------------------------------------------
11-
CMathWorker * g_cMathWorker = new CMathWorker();
12-
bool g_bStarted = false;
13+
CMathWorker * g_cMathWorker = nullptr; //new CMathWorker();
14+
15+
namespace
16+
{
17+
// Starting working threads requires thread synchronization, so it cannot be
18+
// called from DllMain or from static object.
19+
// Each API needs to call ensure_threads_started() to ensure that threads have been
20+
// started prior to continuing.
21+
22+
std::once_flag g_bStarted{};
23+
24+
void ensure_threads_started()
25+
{
26+
std::call_once(g_bStarted,
27+
[]()
28+
{
29+
g_cMathWorker = new CMathWorker();
30+
g_cMathWorker->StartWorkerThreads(0);
31+
});
32+
}
33+
}
1334

1435
static int64_t g_TotalAllocs = 0;
1536
static int64_t g_TotalFree = 0;
@@ -140,18 +161,10 @@ uint64_t GetUTCNanos()
140161
#if defined(_WIN32)
141162
bool APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
142163
{
164+
// NOTE: Cannot do any thread-related work in DllMain.
143165
switch (ul_reason_for_call)
144166
{
145167
case DLL_PROCESS_ATTACH:
146-
147-
if (! g_bStarted)
148-
{
149-
g_bStarted = true;
150-
151-
// default to numa node 0
152-
g_cMathWorker->StartWorkerThreads(0);
153-
}
154-
break;
155168
case DLL_THREAD_ATTACH:
156169
case DLL_THREAD_DETACH:
157170
case DLL_PROCESS_DETACH:
@@ -419,6 +432,8 @@ extern "C"
419432
// pointer to stReadSharedMemory
420433
RT_DLLEXPORT stReadSharedMemory * ReadFromSharedMemory(const char * fileName, const char * shareName)
421434
{
435+
ensure_threads_started();
436+
422437
// uint64_t fileNameSize;
423438
// uint64_t shareNameSize = 0;
424439

@@ -815,6 +830,8 @@ extern "C"
815830
const char * inListNames, // use commas to separate
816831
int64_t totalRows, int64_t bandSize = 0)
817832
{
833+
ensure_threads_started();
834+
818835
bool result = CreateSDSFileInternal(fileName, shareName, metaData,
819836
inListNames, // use commas to separate
820837
totalRows, bandSize);
@@ -829,10 +846,11 @@ extern "C"
829846
// shareName: the sharename the user provided, may be NULL
830847
// Returns:
831848
// true/false
832-
RT_DLLEXPORT bool AppendSDSFile(const char * outFileName,
833-
834-
const char * shareFileName, const char * shareName, int64_t totalRows, int64_t bandSize = 0)
849+
RT_DLLEXPORT bool AppendSDSFile(const char * outFileName, const char * shareFileName, const char * shareName,
850+
int64_t totalRows, int64_t bandSize = 0)
835851
{
852+
ensure_threads_started();
853+
836854
stReadSharedMemory * pSharedMemory = (stReadSharedMemory *)ReadFromSharedMemory(shareFileName, shareName);
837855
if (pSharedMemory)
838856
{

pyproject.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ description = "Python Package with fast math util functions"
44
readme = "README.md"
55
license = { file = "LICENSE" }
66
authors = [{ name = "RTOS Holdings", email = "rtosholdings-bot@sig.com" }]
7-
requires-python = ">=3.9"
7+
requires-python = ">=3.10"
88
dynamic = ["version"]
99
classifiers = [
1010
"Development Status :: 4 - Beta",
1111
"Intended Audience :: Developers",
1212
"Programming Language :: Python :: 3",
13-
"Programming Language :: Python :: 3.9",
1413
"Programming Language :: Python :: 3.10",
1514
"Programming Language :: Python :: 3.11",
1615
"License :: OSI Approved :: BSD License",
@@ -87,10 +86,6 @@ cmake.args = [
8786
]
8887

8988
# Static way of passing current Python version to CMake.
90-
[[tool.scikit-build.overrides]]
91-
if.python-version = "~=3.9"
92-
cmake.define = { "RIPTIDE_PYTHON_VER" = "3.9" }
93-
9489
[[tool.scikit-build.overrides]]
9590
if.python-version = "~=3.10"
9691
cmake.define = { "RIPTIDE_PYTHON_VER" = "3.10" }

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ set(HEADERS
1818
Hook.h
1919
is_member_tg.h
2020
Logger.h
21+
logging/logging.h
2122
MathThreads.h
2223
MathWorker.h
2324
Merge.h
@@ -54,6 +55,7 @@ set(SOURCES
5455
Hook.cpp
5556
is_member_tg.cpp
5657
Logger.cpp
58+
logging/logging.cpp
5759
MathThreads.cpp
5860
MathWorker.cpp
5961
Merge.cpp

0 commit comments

Comments
 (0)