forked from deepmodeling/abacus-develop
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Use memory_op to set diag_const_nums (deepmodeling#5246)
* Use memory_op to set consts * Fix segfault * Pyabacus test * Revert changes * Modify pointer usage * I will win * Malloc test * Initialize with nullptr * Remove useless code --------- Co-authored-by: Haozhi Han <[email protected]>
- Loading branch information
1 parent
08ea40c
commit 545d2ec
Showing
3 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
#ifndef DIAG_CONST_NUMS | ||
#define DIAG_CONST_NUMS | ||
#include "module_base/module_device/memory_op.h" | ||
|
||
template <typename T> | ||
struct const_nums | ||
{ | ||
const_nums(); | ||
T zero; | ||
T one; | ||
T neg_one; | ||
base_device::DEVICE_CPU* cpu_ctx = {}; | ||
T* zero = nullptr; | ||
T* one = nullptr; | ||
T* neg_one = nullptr; | ||
}; | ||
|
||
#endif |
This file contains 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