get_vtx_patches without kokkos - #231
Conversation
- all other code in the file works without kokkos excect this. - moved the kokkos linking guards only wrapping this. - passes all tests locally (including python) - fixes issue SCOREC#230
8cab4a9 to
91b1cd2
Compare
|
@jacobmerson @cwsmith @Sichao25 , Could you please review this? I cannot find the review request button for this PR. |
|
/runtests |
|
Test Results:
|
cwsmith
left a comment
There was a problem hiding this comment.
| [[nodiscard]] Graph adj_segment_sort(Graph& g) { | ||
| auto offsets = g.a2ab; | ||
| auto elms_r = Read(g.ab2b); //read only | ||
| Write<LO> elms(elms_r.size(), "elms"); |
There was a problem hiding this comment.
even though this is outside the kokkos block, I think this should still use a HostWrite to make the intention clear
| auto copyFn = OMEGA_H_LAMBDA(LO i) { | ||
| elms[i] = elms_r[i]; | ||
| }; | ||
| parallel_for(elms.size(), copyFn); | ||
| auto sortFn = OMEGA_H_LAMBDA(LO i) { | ||
| std::sort(elms.begin() + offsets[i], elms.begin() + offsets[i+1]); | ||
| }; | ||
| parallel_for(g.nnodes(), sortFn); |
There was a problem hiding this comment.
likewise, since this is outside the kokkos block, I think it would be easier to read/understand if these were serial for loops instead of parallel_for(...)
There was a problem hiding this comment.
I was thinking that in the future, omega_h parallel for may use the ranges or something else for host parallelism without kokkos and we don't want to manage it here.
There was a problem hiding this comment.
Hmmm. Is std::sort expected to be thread safe is that context? I guess I'd rather do the conservative thing that we know won't break if someone does eventually implement a non-kokkos parallel backend. Note, the plan for the foreseeable future is to only support on-device parallelism via kokkos.
There was a problem hiding this comment.
Okay, I will replace this. Thanks.
removed parallel_for and Read/Write moved test_patch out of kokkos condition
b532295 to
18fb8c4
Compare
|
/runtests |
|
Test Results:
|
|
The test_patches is failing with MPI on 2 ranks where it is expected to fail but here it is getting a segfault. It is failing at this line in a Write::size() call: omega_h/src/Omega_h_shared_alloc.hpp Line 141 in 96463bb Do you have any suggestion how to can I fix this? |
|
I am not sure if this is the intended behavior of |
|
/runtests |
|
Test Results:
|
|
@Fuad-HH The fix for omega_h/src/Omega_h_shared_alloc.hpp Lines 79 to 81 in 96463bb As you gathered, the problem comes when omega_h/src/Omega_h_shared_alloc.hpp Lines 134 to 148 in 96463bb |
|
Thanks @cwsmith. I also had the similar idea looking at the stack trace. |
This function was enabled only when kokkos was linked. Now with the alternative implementation, it can work without kokkos.
There are two assumptions here:
std::sortwhich needs Omega_h to be compiled with c++17 or higher.Fixes issue #230