Require explicit memory management from the user and remove sloppy memory management.#436
Conversation
…ale tests to fail. Made "createIncrementingVector()" return a pointer to the new vector instead of a copy (which causes the data to be freed prematurely).
…arse" This reverts commit 00f6992. Kept changes to "io.cpp", which fixes the an issue with out-of-bounds iterators.
No commented out code.
…HyKKT implementation (if matvec works correctly).
…ed right now, but good to prevent stack overflows.
… doesn't work because MatrixHandler is broken (specifically matvec).
* use caller-provided backend-specific handlers in SCCG * load SCCG data on host before device sync * refresh CUDA SpMV cache when matrix changes * fix HyKKT SCCG HIP target setup * document SCCG backend setup and CUDA SpMV cache handling * mirror SpMV cache reset for HIP * Shaked/random error fix (#424) Fixed stochastic failures due to a faulty random number generator and asynchronous operations. Co-authored-by: shakedregev <shakedregev@users.noreply.github.com> --------- Co-authored-by: tamar-dewilde <tamar-dewilde@users.noreply.github.com> Co-authored-by: Shaked Regev <35384901+shakedregev@users.noreply.github.com> Co-authored-by: shakedregev <shakedregev@users.noreply.github.com>
| for (real_type val = 0.0; val <= 1.0; val += 1.0) | ||
| { // Use a step to prevent infinite loop |
There was a problem hiding this comment.
Not really part of this PR, but it's not clear to me why we have a loop at all here. It's simply the first thing happening, then the second.
There was a problem hiding this comment.
Fixed in the latest commit
shakedregev
left a comment
There was a problem hiding this comment.
Very good work! Tests pass on all platforms. See:
- Some minor documentation comments.
- Some very weird code that was not part of this PR. Should be fixed now or later.
superwhiskers
left a comment
There was a problem hiding this comment.
some minor comments.
i ran the cpu-only tests on my local machine, all cpu tests passed. one warning was not addressed:
ReSolve/examples/sysRefactor.cpp:33:43: warning: unused parameter ‘hw_backend’ [-Wunused-parameter]
33 | static void syncDevice(const std::string& hw_backend)
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
other than that, it seems fine. this warning may be an artifact of a cpu-only build. the gpu build tests are taking a little longer, so i'll leave this review without them.
The full function is So the variable is used if either CUDA or HIP is enabled. @shakedregev Would it be a good idea to add a |
It makes more sense to me to call the function only if you need it. HIP/CUDA |
|
managed to complete the rocm-enabled tests on my local machine after instituting a workaround for a rocm bug related to my specific amd gpu. builds and runs fine. no leaks outside those present within rocm, runs fine. there is one concerning thing, and that is the flakiness of two tests on my machine:
primarily the former. this most likely is not related to this pull request, though. just noting this for future reference. it's probably a tolerance thing, unlikely to be anything significant. |
superwhiskers
left a comment
There was a problem hiding this comment.
still getting this warning on a cpu-only build.
ReSolve/examples/sysRefactor.cpp:33:43: warning: unused parameter ‘hw_backend’ [-Wunused-parameter]
33 | static void syncDevice(const std::string& hw_backend)
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
everything else looks fine.
shakedregev
left a comment
There was a problem hiding this comment.
All tests pass and concerns addressed.
Description
Remove automatic memory allocation and memory syncing in various memory management functions and require the user to explicitly manage their own memory.
Resolves #295.
Proposed changes
Major changes:
Vector::getData()and remove automatic synchronizationcopyFromExternal()and remove automatic allocation for vectors and matricesallocate()andallocateMatrixData()for vectors and matrices and remove auto deallocationisUpdated(),isAllocated(),allocateAll()to VectorallocateAll()to SparseMinor changes:
.gitignoreto ignore test outputsHyKKTSolver::readMatrixFiles()which is unnecessaryChecklist
make testandmake test_installper testing instructions). Code tested on./examples/<your_example>.exe -hto get instructions how to run examples). Code tested on:-Wall -Wpedantic -Wconversion -Wextra.Further comments
I also tried to add status returns to a few functions in the
VectorHandlerandLinAlgWorkspaceseries of classes, but that crashes the HIP implementation for seemingly unknown reasons.