diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81aaaf16c..2530946e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -233,12 +233,15 @@ jobs: # avoid unnecessary use of mac resources - is-full-run: false os: macos-12 + - is-full-run: false os: macos-14 python-version: "3.8" + - is-full-run: false os: macos-14 python-version: "3.9" + - is-full-run: false os: macos-14 python-version: "3.10" @@ -284,7 +287,7 @@ jobs: run: make dist-py-cibw env: CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*" - CIBW_ENVIRONMENT_MACOS: CC="/usr/local/bin/gcc-13" CXX="/usr/local/bin/g++-13" CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}" + CIBW_ENVIRONMENT_MACOS: CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}" CIBW_ARCHS_MACOS: x86_64 CIBW_BUILD_VERBOSITY: 3 if: ${{ matrix.os == 'macos-12' }} @@ -293,7 +296,7 @@ jobs: run: make dist-py-cibw env: CIBW_BUILD: "${{ matrix.cibuildwheel }}-macos*" - CIBW_ENVIRONMENT_MACOS: PATH="/opt/homebrew/opt/bison/bin/:$PATH" CC="/opt/homebrew/bin/gcc-13" CXX="/opt/homebrew/bin/g++-13" LDFLAGS="-Wl,-ld_classic" CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}" + CIBW_ENVIRONMENT_MACOS: CCACHE_DIR="/Users/runner/work/csp/csp/.ccache" VCPKG_DEFAULT_BINARY_CACHE="${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" VCPKG_DOWNLOADS="${{ env.VCPKG_DOWNLOADS }}" CIBW_ARCHS_MACOS: arm64 CIBW_BUILD_VERBOSITY: 3 if: ${{ matrix.os == 'macos-14' }} @@ -308,11 +311,11 @@ jobs: CIBW_ENVIRONMENT_WINDOWS: TODO="todo" if: ${{ matrix.os == 'windows-2022' }} - # Check dist files + ########## + # Common - name: Check Wheels run: make dist-check - # Upload artifacts - name: Upload Wheel uses: actions/upload-artifact@v4 with: @@ -358,15 +361,12 @@ jobs: - name: Install python dependencies run: make requirements - # Build SDist - name: Python SDist Steps run: make dist-py-sdist - # Check dist files - name: Check sdist run: make dist-check - # Upload artifacts - name: Upload SDist uses: actions/upload-artifact@v4 with: @@ -414,28 +414,26 @@ jobs: - os: macos-14 python-version: "3.9" - # Exclude windows builds + # windows is slow, so dont build unless its a full run # - is-full-run: false # os: windows-2022 - # Exclude macOS builds for now - - os: macos-12 - # is-full-run: false # FIXME https://github.com/Point72/csp/issues/33 - - - os: macos-14 - # is-full-run: false # FIXME https://github.com/Point72/csp/issues/33 + # avoid unnecessary use of mac resources + - is-full-run: false + os: macos-12 - # Exclude Python 3.8, 3.10, 3.11 builds - is-full-run: false - python-version: 3.8 + os: macos-14 + python-version: "3.8" - is-full-run: false - python-version: 3.9 + os: macos-14 + python-version: "3.9" - is-full-run: false + os: macos-14 python-version: "3.10" - runs-on: ${{ matrix.os }} steps: @@ -452,26 +450,29 @@ jobs: - name: Install python dependencies run: make requirements + - name: Download wheel + uses: actions/download-artifact@v4 + with: + name: csp-dist-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }} + + ######## + # Linux - name: Install test dependencies (Linux) shell: bash run: sudo apt-get install graphviz if: ${{ runner.os == 'Linux' }} + - name: Install wheel (Linux) + run: python -m pip install -U *manylinux2014*.whl --target . + if: ${{ runner.os == 'Linux' }} + + ######## + # Macos - name: Install test dependencies (Mac) shell: bash run: brew install graphviz if: ${{ runner.os == 'macOS' }} - # Download artifact - - name: Download wheel - uses: actions/download-artifact@v4 - with: - name: csp-dist-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }} - - - name: Install wheel (Linux) - run: python -m pip install -U *manylinux2014*.whl --target . - if: ${{ runner.os == 'Linux' }} - - name: Install wheel (OSX x86) run: python -m pip install -U *x86*.whl --target . if: ${{ runner.os == 'macOS' && runner.arch == 'X64' }} @@ -480,11 +481,14 @@ jobs: run: python -m pip install -U *arm64*.whl --target . if: ${{ runner.os == 'macOS' && runner.arch == 'ARM64' }} + ######## + # Windows - name: Install wheel (windows) run: python -m pip install -U (Get-ChildItem .\*.whl | Select-Object -Expand FullName) --target . if: ${{ runner.os == 'Windows' }} - # Run tests + ########## + # Common - name: Python Test Steps run: make test @@ -532,17 +536,14 @@ jobs: with: cibuildwheel: 'cp39' - # Python - name: Install python dependencies run: make requirements - # Download sdist - uses: actions/download-artifact@v4 with: name: csp-sdist path: dist/ - # Install sdist - name: Install sdist run: python -m pip install -U -vvv dist/csp*.tar.gz --target . env: @@ -550,7 +551,6 @@ jobs: VCPKG_DEFAULT_BINARY_CACHE: /home/runner/vcpkg_cache VCPKG_DOWNLOADS: /home/runner/vcpkg_download_cache - # Test sdist - name: Run tests against from-scratch sdist build run: make test env: @@ -606,7 +606,6 @@ jobs: shell: bash run: sudo apt-get install graphviz - # Download artifact - name: Download wheel uses: actions/download-artifact@v4 with: @@ -618,7 +617,6 @@ jobs: - name: Install package - ${{ matrix.package }} run: python -m pip install -U "${{ matrix.package }}" - # Run tests - name: Python Test Steps run: make test TEST_ARGS="-k TestDBReader" if: ${{ contains( 'sqlalchemy', matrix.package )}} diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index 55762a56b..8152c1ed3 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -29,7 +29,13 @@ permissions: jobs: build: - runs-on: ubuntu-22.04 + strategy: + matrix: + os: + - ubuntu-22.04 + - macos-14 + - macos-12 + runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v4 @@ -37,7 +43,7 @@ jobs: - uses: mamba-org/setup-micromamba@v1 with: micromamba-version: '1.5.7-0' - environment-file: conda/dev-environment-linux.yml + environment-file: conda/dev-environment-unix.yml init-shell: >- bash cache-environment: true @@ -48,14 +54,16 @@ jobs: with: cibuildwheel: 'cp311' - - name: Python Lint Steps (Linux) + - name: Python Lint Steps run: make lint shell: micromamba-shell {0} - - name: Python Build Steps (Linux) + - name: Python Build Steps run: make build-conda shell: micromamba-shell {0} - - name: Python Test Steps (Linux) + - name: Python Test Steps run: make test shell: micromamba-shell {0} + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ca7725af..fbdf2783e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,19 +144,16 @@ endif() # RPath # ######### if(MACOS) - set(CMAKE_INSTALL_RPATH "@loader_path/:@loader_path/../lib") + set(CMAKE_INSTALL_RPATH "@loader_path/") elseif(LINUX) - set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/../lib") + set(CMAKE_INSTALL_RPATH "\$ORIGIN") endif() ################################################################################################################################################### # Flags # ######### # Compiler version flags -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") -endif() - +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") # Optimization Flags if(WIN32) @@ -204,9 +201,13 @@ else() -Wall \ -Wno-deprecated-declarations \ -Wno-deprecated \ - -Wno-maybe-uninitialized \ ") add_definitions(-DNDEBUG) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ + -Wno-maybe-uninitialized \ + ") + endif() endif() endif() diff --git a/Makefile b/Makefile index 569879578..08e56a3b2 100644 --- a/Makefile +++ b/Makefile @@ -182,7 +182,7 @@ clean: ## clean the repository .PHONY: dependencies-mac dependencies-debian dependencies-fedora dependencies-vcpkg dependencies-win dependencies-mac: ## install dependencies for mac - HOMEBREW_NO_AUTO_UPDATE=1 brew install bison cmake flex make ninja # gcc@13 + HOMEBREW_NO_AUTO_UPDATE=1 brew install bison cmake flex make ninja brew unlink bison flex && brew link --force bison flex dependencies-debian: ## install dependencies for linux diff --git a/conda/dev-environment-linux.yml b/conda/dev-environment-unix.yml similarity index 100% rename from conda/dev-environment-linux.yml rename to conda/dev-environment-unix.yml diff --git a/cpp/csp/adapters/parquet/ArrowSingleColumnArrayBuilder.h b/cpp/csp/adapters/parquet/ArrowSingleColumnArrayBuilder.h index c998d4518..136ef7027 100644 --- a/cpp/csp/adapters/parquet/ArrowSingleColumnArrayBuilder.h +++ b/cpp/csp/adapters/parquet/ArrowSingleColumnArrayBuilder.h @@ -304,7 +304,7 @@ class PrimitiveTypedArrayBuilder : public BaseTypedArrayBuilder m_builderPtr -> Append( *this -> m_value ); + [[maybe_unused]] auto status = this -> m_builderPtr -> Append( *this -> m_value ); } }; diff --git a/cpp/csp/adapters/parquet/ParquetOutputAdapter.h b/cpp/csp/adapters/parquet/ParquetOutputAdapter.h index 842b3c136..7148d0fa9 100644 --- a/cpp/csp/adapters/parquet/ParquetOutputAdapter.h +++ b/cpp/csp/adapters/parquet/ParquetOutputAdapter.h @@ -31,6 +31,8 @@ class ParquetOutputHandler { } + virtual ~ParquetOutputHandler() {} + uint32_t getChunkSize() const; virtual uint32_t getNumColumns() = 0; diff --git a/cpp/csp/adapters/parquet/ParquetReader.h b/cpp/csp/adapters/parquet/ParquetReader.h index 1026090e2..c10923bc0 100644 --- a/cpp/csp/adapters/parquet/ParquetReader.h +++ b/cpp/csp/adapters/parquet/ParquetReader.h @@ -376,7 +376,7 @@ class SingleTableParquetReader : public ParquetReader const std::optional &symbol, const DialectGenericListReaderInterface::Ptr &listReaderInterface ) override { ParquetReader::addListSubscriber( column, inputAdapter, symbol, listReaderInterface); - m_columnSubscriptionContainer.m_listColumnSubscriptions[column].push_back(ListColumnSubscriberInfo{inputAdapter, symbol, listReaderInterface}); + m_columnSubscriptionContainer.m_listColumnSubscriptions[column].push_back(ListColumnSubscriberInfo{{inputAdapter, symbol}, listReaderInterface}); } protected: diff --git a/cpp/csp/adapters/parquet/ParquetReaderColumnAdapter.h b/cpp/csp/adapters/parquet/ParquetReaderColumnAdapter.h index 6623a4675..eb7c4a839 100644 --- a/cpp/csp/adapters/parquet/ParquetReaderColumnAdapter.h +++ b/cpp/csp/adapters/parquet/ParquetReaderColumnAdapter.h @@ -134,7 +134,7 @@ class MissingColumnAdapter : public ParquetColumnAdapter bool isMissingColumn() const override{ return true; } - virtual CspTypePtr getNativeCspType() const + virtual CspTypePtr getNativeCspType() const override { CSP_THROW( csp::RuntimeException, "Trying to get native type of a missing column " << getColumnName() ); } @@ -190,8 +190,7 @@ template< typename ValueType, typename ArrowArrayType > class NativeTypeColumnAdapter : public BaseTypedColumnAdapter { public: - using BASE = BaseTypedColumnAdapter; - using BASE::BaseTypedColumnAdapter; + using BaseTypedColumnAdapter::BaseTypedColumnAdapter; virtual CspTypePtr getNativeCspType() const override {return CspType::fromCType::type();} protected: diff --git a/cpp/csp/adapters/utils/JSONMessageWriter.h b/cpp/csp/adapters/utils/JSONMessageWriter.h index 5a81e5766..e568ea793 100644 --- a/cpp/csp/adapters/utils/JSONMessageWriter.h +++ b/cpp/csp/adapters/utils/JSONMessageWriter.h @@ -63,7 +63,7 @@ class JSONMessageWriter : public MessageWriter } private: - void processTickImpl( const OutputDataMapper & dataMapper, const TimeSeriesProvider * sourcets ) + void processTickImpl( const OutputDataMapper & dataMapper, const TimeSeriesProvider * sourcets ) override { dataMapper.apply( *this, sourcets ); } diff --git a/cpp/csp/adapters/utils/MessageStructConverter.h b/cpp/csp/adapters/utils/MessageStructConverter.h index a6b6c9dd2..9cac76472 100644 --- a/cpp/csp/adapters/utils/MessageStructConverter.h +++ b/cpp/csp/adapters/utils/MessageStructConverter.h @@ -17,6 +17,8 @@ class MessageStructConverter { public: MessageStructConverter( const CspTypePtr & type, const Dictionary & properties ); + virtual ~MessageStructConverter() {} + virtual csp::StructPtr asStruct( void * bytes, size_t size ) = 0; virtual MsgProtocol protocol() const = 0; diff --git a/cpp/csp/core/QueueWaiter.h b/cpp/csp/core/QueueWaiter.h index b95625a02..307930cd5 100644 --- a/cpp/csp/core/QueueWaiter.h +++ b/cpp/csp/core/QueueWaiter.h @@ -31,10 +31,10 @@ class QueueWaiter std::unique_lock lock( m_lock ); bool rv = false; if( !m_eventsPending && maxWaitTime.asNanoseconds() > 0 ) - { - rv = ( m_condition.wait_for( lock, std::chrono::nanoseconds( maxWaitTime.asNanoseconds() ) ) == std::cv_status::no_timeout ); - } - m_eventsPending = false; + rv = m_condition.wait_for( lock, std::chrono::nanoseconds( maxWaitTime.asNanoseconds() ), [this]() { return m_eventsPending; } ); + + if( rv ) + m_eventsPending = false; return rv; } diff --git a/cpp/csp/cppnodes/statsimpl.h b/cpp/csp/cppnodes/statsimpl.h index 88926d6b6..765b3aac2 100644 --- a/cpp/csp/cppnodes/statsimpl.h +++ b/cpp/csp/cppnodes/statsimpl.h @@ -1163,7 +1163,7 @@ class Quantile int ft = floor( target ); int ct = ceil( target ); - double qtl; + double qtl = 0.0; #ifndef __clang__ switch ( m_interpolation ) { diff --git a/cpp/csp/engine/ConstInputAdapter.h b/cpp/csp/engine/ConstInputAdapter.h index 7f1d3b51f..691b55078 100644 --- a/cpp/csp/engine/ConstInputAdapter.h +++ b/cpp/csp/engine/ConstInputAdapter.h @@ -1,4 +1,4 @@ -#ifndef _IN_CSP_ENGINE_ALARMINPUTADAPTER_H +#ifndef _IN_CSP_ENGINE_CONSTINPUTADAPTER_H #define _IN_CSP_ENGINE_CONSTINPUTADAPTER_H #include diff --git a/cpp/csp/engine/CppNode.h b/cpp/csp/engine/CppNode.h index 75457a366..554b0695a 100644 --- a/cpp/csp/engine/CppNode.h +++ b/cpp/csp/engine/CppNode.h @@ -161,9 +161,9 @@ class CppNode : public csp::Node using InputWrapper::InputWrapper; operator const T &() { return lastValue(); } - const T & lastValue() const { return ts() -> lastValueTyped(); } + const T & lastValue() const { return ts() -> template lastValueTyped(); } - const T & valueAtIndex( int32_t index ) const { return ts() -> valueAtIndex( index ); } + const T & valueAtIndex( int32_t index ) const { return ts() -> template valueAtIndex( index ); } }; template @@ -379,7 +379,7 @@ class CppNode : public csp::Node T & reserveSpace() { - return ts() -> reserveTickTyped( m_node.cycleCount(), m_node.now() ); + return ts() -> template reserveTickTyped( m_node.cycleCount(), m_node.now() ); } }; @@ -644,7 +644,7 @@ struct csp::CppNode::AlarmTypeHelper } #define INIT_CPPNODE_WITH_NAME( Class, Name ) \ - CSP csp; \ + [[maybe_unused]] CSP csp; \ public: \ const char * name() const override { return #Name; } \ _STATIC_CREATE_METHOD( Class ) \ diff --git a/cpp/csp/engine/CspType.h b/cpp/csp/engine/CspType.h index 13d740461..225dc958b 100644 --- a/cpp/csp/engine/CspType.h +++ b/cpp/csp/engine/CspType.h @@ -102,7 +102,7 @@ class CspType static Ptr & BYTES(); static Ptr & DIALECT_GENERIC() { static auto s_type = std::make_shared( Type::DIALECT_GENERIC ); return s_type; } - static constexpr bool isNative( Type t ) { return t <= Type::MAX_NATIVE_TYPE; } + static constexpr bool isNative( TypeTraits::_enum t ) { return t <= TypeTraits::MAX_NATIVE_TYPE; } bool isNative() const { return isNative( m_type ); } @@ -185,7 +185,6 @@ class CspArrayType : public CspType CspTypePtr m_elemType; }; -template<> struct CspType::TypeTraits::fromCType { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::BOOL; }; template<> struct CspType::TypeTraits::fromCType { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::BOOL; }; template<> struct CspType::TypeTraits::fromCType { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::INT8; }; template<> struct CspType::TypeTraits::fromCType { static constexpr CspType::TypeTraits::_enum type = CspType::TypeTraits::UINT8; }; diff --git a/cpp/csp/engine/DialectGenericType.h b/cpp/csp/engine/DialectGenericType.h index 9a343250d..0527be5af 100644 --- a/cpp/csp/engine/DialectGenericType.h +++ b/cpp/csp/engine/DialectGenericType.h @@ -26,7 +26,7 @@ struct DialectGenericType size_t hash() const; private: - void* m_data; + [[maybe_unused]] void* m_data; }; std::ostream & operator<<( std::ostream & o, const DialectGenericType & obj ); diff --git a/cpp/csp/engine/DynamicEngine.h b/cpp/csp/engine/DynamicEngine.h index 714a79f4f..e45392c6d 100644 --- a/cpp/csp/engine/DynamicEngine.h +++ b/cpp/csp/engine/DynamicEngine.h @@ -1,5 +1,5 @@ #ifndef _IN_CSP_ENGINE_DYNAMICENGINE_H -#define _IN_CSP_ENGINE_DUNAMICENGINE_H +#define _IN_CSP_ENGINE_DYNAMICENGINE_H #include #include diff --git a/cpp/csp/engine/Feedback.h b/cpp/csp/engine/Feedback.h index fd0678d2d..0194d9257 100644 --- a/cpp/csp/engine/Feedback.h +++ b/cpp/csp/engine/Feedback.h @@ -62,7 +62,7 @@ inline FeedbackOutputAdapter::FeedbackOutputAdapter( csp::Engine * engine, template inline void FeedbackOutputAdapter::executeImpl() { - m_boundInput -> pushTick( input() -> lastValueTyped() ); + m_boundInput -> pushTick( input() -> template lastValueTyped() ); } } diff --git a/cpp/csp/engine/PendingPushEvents.h b/cpp/csp/engine/PendingPushEvents.h index 803424eae..5036e7fd2 100644 --- a/cpp/csp/engine/PendingPushEvents.h +++ b/cpp/csp/engine/PendingPushEvents.h @@ -7,7 +7,7 @@ namespace csp { -class PushGroup; +struct PushGroup; class PushInputAdapters; class PendingPushEvents diff --git a/cpp/csp/engine/RootEngine.cpp b/cpp/csp/engine/RootEngine.cpp index f6a51c651..a65f3a5d1 100644 --- a/cpp/csp/engine/RootEngine.cpp +++ b/cpp/csp/engine/RootEngine.cpp @@ -160,6 +160,7 @@ void RootEngine::runRealtime( DateTime end ) std::vector dirtyGroups; m_inRealtime = true; + bool haveEvents = false; while( m_state == State::RUNNING && !g_SIGNALED ) { TimeDelta waitTime; @@ -171,9 +172,13 @@ void RootEngine::runRealtime( DateTime end ) waitTime = std::min( m_scheduler.nextTime() - DateTime::now(), waitTime ); } + if( !haveEvents ) { + //We keep the haveEvents flag in case there were events, but we only decided to execute + //timers in the previous cycle, then we shouldnt wait again ( which can actually lead to cases + //where we miss triggers ) DialectReleaseGIL release( this ); - m_pushEventQueue.wait( waitTime ); + haveEvents = m_pushEventQueue.wait( waitTime ); } //grab time after waitForEvents so that we dont grab events with time > now @@ -201,6 +206,7 @@ void RootEngine::runRealtime( DateTime end ) group -> state = PushGroup::NONE; dirtyGroups.clear(); + haveEvents = false; } m_cycleStepTable.executeCycle( m_profiler.get() ); diff --git a/cpp/csp/engine/RootEngine.h b/cpp/csp/engine/RootEngine.h index 8b8c34167..e3999d572 100644 --- a/cpp/csp/engine/RootEngine.h +++ b/cpp/csp/engine/RootEngine.h @@ -22,6 +22,7 @@ class Dictionary; class EndCycleListener { public: + virtual ~EndCycleListener() {}; virtual void onEndCycle() = 0; bool isDirty() const { return m_dirty; } diff --git a/cpp/csp/engine/Struct.h b/cpp/csp/engine/Struct.h index 21e8558e6..0cd83762f 100644 --- a/cpp/csp/engine/Struct.h +++ b/cpp/csp/engine/Struct.h @@ -275,22 +275,22 @@ class StringStructField final : public NonNativeStructField setIsSet( s ); } - virtual void copyFrom( const Struct * src, Struct * dest ) const + virtual void copyFrom( const Struct * src, Struct * dest ) const override { value( dest ) = value( src ); } - virtual void deepcopyFrom( const Struct * src, Struct * dest ) const + virtual void deepcopyFrom( const Struct * src, Struct * dest ) const override { value( dest ) = value( src ); } - virtual bool isEqual( const Struct * x, const Struct * y ) const + virtual bool isEqual( const Struct * x, const Struct * y ) const override { return value( x ) == value( y ); } - virtual size_t hash( const Struct * x ) const + virtual size_t hash( const Struct * x ) const override { return std::hash()( value( x ) ); } @@ -319,7 +319,7 @@ class ArrayStructField : public NonNativeStructField { dest = src; } - + static void deepcopy( const std::vector & src, std::vector & dest ) { dest = src; diff --git a/cpp/csp/engine/VectorContainer.cpp b/cpp/csp/engine/VectorContainer.cpp index bfec0980f..3ab92a7c4 100644 --- a/cpp/csp/engine/VectorContainer.cpp +++ b/cpp/csp/engine/VectorContainer.cpp @@ -29,7 +29,7 @@ std::unique_ptr VectorContainer::createForCspType(CspTypePtr &t std::unique_ptr VectorContainer::createForCspType( const CspType *type, bool optionalValues ) { - return AllCspTypeSwitch::invoke(type, [type, optionalValues]( auto tag ) + return AllCspTypeSwitch::invoke(type, [optionalValues]( auto tag ) { if(optionalValues) { diff --git a/cpp/csp/python/InitHelper.h b/cpp/csp/python/InitHelper.h index 419c319bc..3023919ec 100644 --- a/cpp/csp/python/InitHelper.h +++ b/cpp/csp/python/InitHelper.h @@ -77,7 +77,7 @@ inline InitHelper::InitCallback InitHelper::moduleMethodsCallback( PyMethodDef * inline InitHelper::InitCallback InitHelper::moduleMethod( const char * name, PyCFunction func, int flags, const char * doc ) { - PyMethodDef defs[2]{ { name, func, flags, doc }, nullptr }; + PyMethodDef defs[2]{ { name, func, flags, doc }, { nullptr } }; //Note that we rely on the lambda closure to keep the lifetime of defs which is kept by ptr //m_callbacks will keep the InitCallback around for the life of the program diff --git a/cpp/csp/python/PyCspType.h b/cpp/csp/python/PyCspType.h index e71da4061..bb53ac3c7 100644 --- a/cpp/csp/python/PyCspType.h +++ b/cpp/csp/python/PyCspType.h @@ -12,9 +12,9 @@ static_assert( alignof( csp::DialectGenericType ) == alignof( csp::python::PyObj namespace csp { template<> -struct CspType::Type::fromCType +struct CspType::TypeTraits::fromCType { - static constexpr csp::CspType::Type type = csp::CspType::Type::DIALECT_GENERIC; + static constexpr csp::CspType::TypeTraits::_enum type = csp::CspType::TypeTraits::DIALECT_GENERIC; }; } diff --git a/cpp/csp/python/adapters/parquetadapterimpl.cpp b/cpp/csp/python/adapters/parquetadapterimpl.cpp index 67020d056..589e7c459 100644 --- a/cpp/csp/python/adapters/parquetadapterimpl.cpp +++ b/cpp/csp/python/adapters/parquetadapterimpl.cpp @@ -256,8 +256,7 @@ class NumpyArrayWriterImpl : public TypedDialectGenericListWriterInterface class NumpyUnicodeArrayWriter : public TypedDialectGenericListWriterInterface { public: - NumpyUnicodeArrayWriter( PyArray_Descr *expectedArrayDesc ) - : m_expectedArrayDesc( expectedArrayDesc ) + NumpyUnicodeArrayWriter() { } @@ -330,8 +329,7 @@ static inline DialectGenericListWriterInterface::Ptr create_numpy_array_writer_i if( numpy_dtype -> type_num == NPY_UNICODE ) { - return std::make_shared( - numpy_dtype ); + return std::make_shared(); } else { @@ -383,7 +381,7 @@ class NumpyArrayReaderImpl final : public TypedDialectGenericListReaderInterface return reinterpret_cast(PyArray_DATA( arrayObject )); } - virtual void setValue(const csp::DialectGenericType& list, int index, const V& value) + virtual void setValue(const csp::DialectGenericType& list, int index, const V& value) override { getRawDataBuffer(list)[index] = value; } @@ -395,8 +393,7 @@ class NumpyArrayReaderImpl final : public TypedDialectGenericListReaderInterface class NumpyUnicodeReaderImpl final : public TypedDialectGenericListReaderInterface { public: - NumpyUnicodeReaderImpl( PyArray_Descr *expectedArrayDesc ) - : m_expectedArrayDesc( expectedArrayDesc ) + NumpyUnicodeReaderImpl() { } @@ -437,9 +434,6 @@ class NumpyUnicodeReaderImpl final : public TypedDialectGenericListReaderInterfa auto nElementsToCopy = std::min( int(elementSize / sizeof(wchar_t)), int( wideValue.size() + 1 ) ); std::copy_n( wideValue.c_str(), nElementsToCopy, reinterpret_cast(PyArray_GETPTR1( arrayObject, index )) ); } - -private: - PyArray_Descr *m_expectedArrayDesc; }; @@ -458,8 +452,7 @@ inline DialectGenericListReaderInterface::Ptr create_numpy_array_reader_impl( co if( numpy_dtype -> type_num == NPY_UNICODE ) { - return std::make_shared( - numpy_dtype ); + return std::make_shared(); } else { diff --git a/cpp/csp/python/cspbaselibimpl.cpp b/cpp/csp/python/cspbaselibimpl.cpp index c34351e9f..039fb8134 100644 --- a/cpp/csp/python/cspbaselibimpl.cpp +++ b/cpp/csp/python/cspbaselibimpl.cpp @@ -170,7 +170,7 @@ DECLARE_CPPNODE( exprtk_impl ) { PartialSwitchCspType::invoke( typ, - [ this, &inputName ]( auto tag ) + [ this ]( auto tag ) { s_valuesContainer.push_back( std::make_unique>() ); } ); diff --git a/cpp/csp/python/cspimpl.cpp b/cpp/csp/python/cspimpl.cpp index 1b362455d..8527aeb6d 100644 --- a/cpp/csp/python/cspimpl.cpp +++ b/cpp/csp/python/cspimpl.cpp @@ -124,7 +124,7 @@ static PyMethodDef _cspimpl_methods[] = { {"create_traceback", (PyCFunction) _create_traceback, METH_VARARGS, "internal"}, {"_csp_engine_stats", (PyCFunction) _engine_stats, METH_O, "engine statistics"}, {"set_capture_cpp_backtrace", (PyCFunction) _set_capture_cpp_backtrace, METH_VARARGS, "internal"}, - nullptr + {nullptr} }; static PyModuleDef _cspimpl_module = { diff --git a/cpp/tests/core/test_time.cpp b/cpp/tests/core/test_time.cpp index 60c56dac3..3264c5d3d 100644 --- a/cpp/tests/core/test_time.cpp +++ b/cpp/tests/core/test_time.cpp @@ -159,6 +159,7 @@ TEST( DateTimeEx, test_basic_functionality ) ASSERT_EQ( ex2.microseconds(), 123456 ); ASSERT_EQ( ex2.nanoseconds(), 123456789 ); +#ifdef __linux__ dt = DateTime( 1888, 11, 15, 23, 15, 59, 999999999 ); DateTimeEx ex3( dt ); @@ -172,6 +173,7 @@ TEST( DateTimeEx, test_basic_functionality ) ASSERT_EQ( ex3.milliseconds(), 999 ); ASSERT_EQ( ex3.microseconds(), 999999 ); ASSERT_EQ( ex3.nanoseconds(), 999999999 ); +#endif } TEST( TimeTest, test_basic_functionality ) diff --git a/csp/adapters/parquet.py b/csp/adapters/parquet.py index 85e457ee0..e88fcfeaa 100644 --- a/csp/adapters/parquet.py +++ b/csp/adapters/parquet.py @@ -1,7 +1,6 @@ import datetime import io import numpy -import platform import pyarrow import pyarrow.parquet from importlib.metadata import PackageNotFoundError, version as get_package_version @@ -101,9 +100,6 @@ def __init__( self._properties["tz"] = tz.zone if binary_arrow: self._properties["is_arrow_ipc"] = True - if not binary_arrow and platform.system() == "Darwin": - # TKP fix parquet reading on darwin - raise RuntimeError("Cannot read parquet files on macOS yet") if start_time: self._properties["start_time"] = start_time if end_time: diff --git a/csp/tests/adapters/test_parquet.py b/csp/tests/adapters/test_parquet.py index 73a4261e1..64e79232e 100644 --- a/csp/tests/adapters/test_parquet.py +++ b/csp/tests/adapters/test_parquet.py @@ -2,11 +2,9 @@ import numpy import os import pandas -import platform import polars import pyarrow import pyarrow.parquet -import pytest import pytz import tempfile import unittest @@ -34,7 +32,6 @@ class PriceQuantity2(csp.Struct): arrow_filename = os.path.join(os.path.dirname(__file__), "arrow_test_data.arrow") -@pytest.mark.skipif(platform.system() == "Darwin", reason="Does not run on macOS") class TestParquetReader(unittest.TestCase): def do_test_body(self, filename, arrow=False): @csp.graph diff --git a/csp/tests/test_engine.py b/csp/tests/test_engine.py index b8ffc1d5b..3ae54afbb 100644 --- a/csp/tests/test_engine.py +++ b/csp/tests/test_engine.py @@ -1334,7 +1334,7 @@ def test_datetime_timedelta_ranges(self): datetime(1969, 5, 6, 2, 3, 4), datetime(1969, 5, 6, 2, 3, 4, 123456), # Edge cases, DateTime MIN / MAX - datetime(1678, 1, 1), + datetime(1678, 1, 1) if sys.platform == "linux" else datetime(1970, 1, 1), datetime(2261, 12, 31, 23, 59, 59, 999999), timedelta(days=1, seconds=3600, microseconds=123456), timedelta(days=-1, seconds=3600, microseconds=123456), diff --git a/docs/wiki/98.-Building-From-Source.md b/docs/wiki/98.-Building-From-Source.md index 1431dadf7..cc39d82be 100644 --- a/docs/wiki/98.-Building-From-Source.md +++ b/docs/wiki/98.-Building-From-Source.md @@ -45,7 +45,8 @@ git submodule update --init --recursive ```bash # Note the operating system, change as needed -micromamba create -n csp -f conda/dev-environment-linux.yml +# Linux and MacOS should use the unix dev environment spec +micromamba create -n csp -f conda/dev-environment-unix.yml micromamba activate csp ``` @@ -111,9 +112,6 @@ sudo dnf group install "Development Tools" make dependencies-mac # or # brew install bison cmake flex make ninja - -# for g++ -brew install gcc ``` ## Install Python dependencies @@ -145,30 +143,6 @@ make build # python setup.py build build_ext --inplace ``` -### Building on `macOS` - -**NOTE** On `macOS`, we need to use `g++`. Complicating this, `g++` is often aliased to `clang++`, so we need to be explicit: - -Apple Silicon (ARM): - -```bash -CXX=/opt/homebrew/bin/g++-13 make build - -# or -# CXX=/opt/homebrew/bin/g++-13 python setup.py build build_ext --inplace -``` - -Intel: - -```bash -CXX=/usr/local/bin/g++-13 make build - -# or -# CXX=/usr/local/bin/g++-13 python setup.py build build_ext --inplace -``` - -Substitute your installed version of `g++` as necessary. - ### Building on `aarch64` Linux On `aarch64` Linux the VCPKG_FORCE_SYSTEM_BINARIES environment variable must be set before running `make build`: diff --git a/setup.py b/setup.py index 1a77a139f..ab8cc2f08 100644 --- a/setup.py +++ b/setup.py @@ -58,7 +58,7 @@ if "CXX" in os.environ: cmake_args.append(f"-DCMAKE_CXX_COMPILER={os.environ['CXX']}") - + if "DEBUG" in os.environ: cmake_args.append("-DCMAKE_BUILD_TYPE=Debug")