Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several enhancements and new features to the
sharrow
project, focusing on improving the workflow and adding new functionalities. The most significant changes include updates to the GitHub Actions workflow, new templates for array operations, and additional parameters for parallel computation.Workflow Enhancements
.github/workflows/run-tests.yml
: Added a new jobactivitysim-examples
to test updates tosharrow
against ActivitySim examples. This job includes steps for setting up the environment, caching dependencies, and running tests.New Templates and Functions
sharrow/flows.py
: IntroducedCOLUMN_FILLER_TEMPLATE
andARRAY_MAKER_TEMPLATE
for generating functions that fill arrays and create arrays, respectively. These templates support different dimensions and improve code modularity. The array_maker approach avoids jit-compiling large functions in favor of compiling multiple smaller functions; some modest loss in compiler optimizations is sacrificed for potentially very large improvements in compile times. [1] [2]Parallel Computation Enhancements
sharrow/flows.py
: Added parametersparallel_irunner
andparallel_idotter
to control parallel computation in various functions. The default value forparallel_irunner
is now set toFalse
. The runner is the simplestsharrow
function, which simply assembles the flow into an array of data. Parallelism on this function provides typically only modest benefits unless data structures are very large; but compile time for parallelism has been observed to increase worse-than-linearly with larger specifications (i.e. doubling the number of spec rows results in much more than double the compile time when parallelism is active). Parallel computation is often disabled anyhow by ActivitySim users, in which case the increased compile time provides no benefit at all. Updated function templates to use these parameters, allowing more granular control over parallel execution. [1] [2] [3]Array Maker Integration
sharrow/flows.py
: Added the option to use the newarray_maker
functions inload
,load_dataframe
, andload_dataarray
methods. This allows for more flexible and efficient array creation. [1] [2] [3] [4]Code Refactoring
sharrow/flows.py
: Refactored various parts of the code to integrate the new templates and improve readability. This includes changes to initialization functions and the addition of new methods for filling and creating arrays. [1] [2] [3]