-
Notifications
You must be signed in to change notification settings - Fork 6
This fixes cmake for permutation in HyKKT #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
b5d326d
added new permutation kernels
shakedregev df765dd
edited cmake
shakedregev 1dd20c4
added Hello world tests
shakedregev 66c947f
added Hello world tests
shakedregev 7e53932
resolved conflict
shakedregev 8d9631b
hykkt hello world working, working on linking for permutation
shakedregev d06e86f
resolved conflict
shakedregev dc937d5
Ignore files in resolve/hybrid dir.
pelesh a0e2d5a
Remove cpu subdirectory in hykkt dir.
pelesh 9e91495
hykkt lib builds.
pelesh 93f7198
Fix issues in CMake related to HyKKT build.
pelesh 59c1c6d
resolved conflict
shakedregev f6aa92c
HyKKT permutation test works.
pelesh f335cfb
modifications for CUDA
shakedregev b044767
removed extraneous tests
shakedregev 1fe399f
reformatted according to contributing guidelines
shakedregev b6b1617
fixed straggling old names
shakedregev 40e671c
stash
shakedregev f663e36
fixed capitalization for selectionSort2
shakedregev d439018
fixed capitalization for selectionSort2
shakedregev e873667
doesn't add hykkt if not using suitesparse
shakedregev bed24af
doesn't add hykkt if not using suitesparse
shakedregev 0592edc
added namespaces and capitalized enums
shakedregev 91c0f04
fixed naming
shakedregev 4eb17c2
function alignment
shakedregev fa242c1
namespace fixes, const where possible
shakedregev 7c013d3
Fix issue with linking workspace to HyKKT. (#211)
pelesh 08d08b1
Coding style suggestions (#213)
pelesh 2522866
added requested changes
shakedregev ea52fbc
addressed Doxygen comment issues
shakedregev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,3 +15,4 @@ spack-configure-* | |
| docs/dox.warnings | ||
| docs/@[email protected] | ||
| docs/html | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #[[ | ||
|
|
||
| @brief Build ReSolve matrix module | ||
|
|
||
| @author Slaven Peles <[email protected]> | ||
|
|
||
| ]] | ||
|
|
||
| # C++ code | ||
| set(HyKKT_SRC | ||
| PermClass.cpp | ||
| cpuHykktPermutationKernels.cpp | ||
| ) | ||
|
|
||
| # C++ code that depends on CUDA SDK libraries | ||
| set(HyKKT_CUDASDK_SRC | ||
| ) | ||
|
|
||
| # and on HIP | ||
| set(HyKKT_ROCM_SRC | ||
| ) | ||
|
|
||
| # Header files to be installed | ||
| set(HyKKT_HEADER_INSTALL | ||
| PermClass.hpp | ||
| cpuHykktPermutationKernels.hpp | ||
| ) | ||
|
|
||
| # Build shared library ReSolve::matrix | ||
| add_library(resolve_hykkt SHARED ${HyKKT_SRC}) | ||
| target_link_libraries(resolve_hykkt PUBLIC resolve_logger resolve_vector ${suitesparse_amd}) | ||
| target_include_directories(resolve_hykkt PUBLIC ${SUITESPARSE_INCLUDE_DIR}) | ||
|
|
||
| # Link to CUDA ReSolve backend if CUDA is support enabled | ||
| if (RESOLVE_USE_CUDA) | ||
| # target_sources(resolve_hykkt PRIVATE ${HyKKT_CUDASDK_SRC}) | ||
| # target_link_libraries(resolve_hykkt PUBLIC resolve_backend_cuda) | ||
| endif() | ||
|
|
||
| if (RESOLVE_USE_HIP) | ||
| # target_sources(resolve_hykkt PRIVATE ${HyKKT_ROCM_SRC}) | ||
| # target_link_libraries(resolve_hykkt PUBLIC resolve_backend_hip) | ||
| endif() | ||
|
|
||
| # Link to dummy device backend if GPU support is not enabled | ||
| if (NOT RESOLVE_USE_GPU) | ||
| target_link_libraries(resolve_hykkt PUBLIC resolve_backend_cpu) | ||
| endif() | ||
|
|
||
| target_include_directories(resolve_hykkt INTERFACE | ||
| $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}> | ||
| $<INSTALL_INTERFACE:include> | ||
| ) | ||
|
|
||
| install(FILES ${HyKKT_HEADER_INSTALL} DESTINATION include/resolve/hykkt) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| #include <resolve/hykkt/PermClass.hpp> | ||
| #include <resolve/hykkt/cpuHykktPermutationKernels.hpp> | ||
| #include <cstdio> | ||
| #include "amd.h" | ||
|
|
||
| // Creates a class for the permutation of $H_\gamma$ in (6) | ||
| PermClass::PermClass(int n_h, int nnz_h, int nnz_j) | ||
| : n_h_(n_h), | ||
| nnz_h_(nnz_h), | ||
| nnz_j_(nnz_j) | ||
| { | ||
| allocateWorkspace(); | ||
| } | ||
|
|
||
| PermClass::~PermClass() | ||
| { | ||
| if(perm_is_default_){ | ||
| delete [] perm_; | ||
| } | ||
| delete [] rev_perm_; | ||
| delete [] perm_map_h_; | ||
| delete [] perm_map_j_; | ||
| delete [] perm_map_jt_; | ||
| } | ||
|
|
||
| void PermClass::addHInfo(int* h_i, int* h_j) | ||
| { | ||
| h_i_ = h_i; | ||
| h_j_ = h_j; | ||
| } | ||
|
|
||
| void PermClass::addJInfo(int* j_i, int* j_j, int n_j, int m_j) | ||
| { | ||
| j_i_ = j_i; | ||
| j_j_ = j_j; | ||
| n_j_ = n_j; | ||
| m_j_ = m_j; | ||
| } | ||
|
|
||
| void PermClass::addJtInfo(int* jt_i, int* jt_j) | ||
| { | ||
| jt_i_ = jt_i; | ||
| jt_j_ = jt_j; | ||
| } | ||
|
|
||
| void PermClass::addPerm(int* custom_perm) | ||
| { | ||
| perm_is_default_ = false; | ||
| perm_ = custom_perm; | ||
| } | ||
|
|
||
| // symAmd permutation of $H_\gamma$ in (6) | ||
| void PermClass::symAmd() | ||
| { | ||
| double Control[AMD_CONTROL], Info[AMD_INFO]; | ||
|
|
||
| amd_defaults(Control); | ||
| amd_control(Control); | ||
|
|
||
| int result = amd_order(n_h_, h_i_, h_j_, perm_, Control, Info); | ||
|
|
||
| if (result != AMD_OK) | ||
| { | ||
| printf("AMD failed\n"); | ||
| exit(1); | ||
| } | ||
| } | ||
|
|
||
| void PermClass::invertPerm() | ||
| { | ||
| reversePerm(n_h_, perm_, rev_perm_); | ||
| } | ||
|
|
||
| void PermClass::vecMapRC(int* b_i, int* b_j) | ||
| { | ||
| makeVecMapRC(n_h_, h_i_, h_j_, perm_, rev_perm_, b_i, b_j, perm_map_h_); | ||
| } | ||
|
|
||
| void PermClass::vecMapC(int* b_j) | ||
| { | ||
| makeVecMapC(n_j_, j_i_, j_j_, rev_perm_, b_j, perm_map_j_); | ||
| } | ||
|
|
||
| void PermClass::vecMapR(int* b_i, int* b_j) | ||
| { | ||
| makeVecMapR(m_j_, jt_i_, jt_j_, perm_, b_i, b_j, perm_map_jt_); | ||
| } | ||
|
|
||
| void PermClass::map_index(PermutationType permutation, | ||
| double* old_val, | ||
| double* new_val) | ||
| { | ||
| switch(permutation) | ||
| { | ||
| case perm_v: | ||
| cpuMapIdx(n_h_, perm_, old_val, new_val); | ||
| break; | ||
| case rev_perm_v: | ||
| cpuMapIdx(n_h_, rev_perm_, old_val, new_val); | ||
| break; | ||
| case perm_h_v: | ||
| cpuMapIdx(nnz_h_, perm_map_h_, old_val, new_val); | ||
| break; | ||
| case perm_j_v: | ||
| cpuMapIdx(nnz_j_, perm_map_j_, old_val, new_val); | ||
| break; | ||
| case perm_jt_v: | ||
| cpuMapIdx(nnz_j_, perm_map_jt_, old_val, new_val); | ||
| break; | ||
| default: | ||
| printf("Valid arguments are perm_v, rev_perm_v, perm_h_v, perm_j_v, perm_jt_v\n"); | ||
| } | ||
| } | ||
|
|
||
| void PermClass::allocateWorkspace() | ||
| { | ||
| perm_ = new int[n_h_]; | ||
| rev_perm_ = new int[n_h_]; | ||
| perm_map_h_ = new int[nnz_h_]; | ||
| perm_map_j_ = new int[nnz_j_]; | ||
| perm_map_jt_ = new int[nnz_j_]; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.