Skip to content

Commit 262ce2a

Browse files
committed
Fix parallel usage
1 parent a523ccb commit 262ce2a

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

source/module_base/kernels/dsp/dsp_connector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
// Base dsp functions
66
void dspInitHandle(int id);
7-
void dspDestoryHandle();
8-
void *malloc_ht(size_t bytes);
7+
void dspDestoryHandle(int id);
8+
void *malloc_ht(size_t bytes, int cluster_id);
99
void free_ht(void* ptr);
1010

1111

source/module_base/module_device/memory_op.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "module_base/tool_threading.h"
55
#ifdef __DSP
66
#include "module_base/kernels/dsp/dsp_connector.h"
7+
#include "module_base/global_variable.h"
78
#endif
89

910
#include <complex>
@@ -28,7 +29,7 @@ struct resize_memory_op<FPTYPE, base_device::DEVICE_CPU>
2829
#endif
2930
}
3031
#ifdef __DSP
31-
arr = (FPTYPE*)malloc_ht(sizeof(FPTYPE) * size);
32+
arr = (FPTYPE*)malloc_ht(sizeof(FPTYPE) * size, GlobalV::MY_RANK);
3233
#else
3334
arr = (FPTYPE*)malloc(sizeof(FPTYPE) * size);
3435
#endif

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ ESolver_KS_PW<T, Device>::ESolver_KS_PW()
7373
#endif
7474
#ifdef __DSP
7575
std::cout << " ** Initializing DSP Hardware..." << std::endl;
76-
dspInitHandle(GlobalV::MY_RANK % 4);
76+
dspInitHandle(GlobalV::MY_RANK);
7777
#endif
7878
}
7979

@@ -102,7 +102,7 @@ ESolver_KS_PW<T, Device>::~ESolver_KS_PW()
102102
}
103103
#ifdef __DSP
104104
std::cout << " ** Closing DSP Hardware..." << std::endl;
105-
dspDestoryHandle();
105+
dspDestoryHandle(GlobalV::MY_RANK);
106106
#endif
107107
if (PARAM.inp.precision == "single")
108108
{

0 commit comments

Comments
 (0)