Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -66,4 +66,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
Original file line number Diff line number Diff line change
Expand Up @@ -203,21 +203,8 @@ CVoid GDynamicEngine::fatWait() {
#ifdef _CGRAPH_PARALLEL_MICRO_BATCH_ENABLE_
CVoid GDynamicEngine::parallelRunAll() {
// 微任务模式,主要用于性能测试的场景下
const UThreadPoolConfig& config = thread_pool_->getConfig();
CSize thdNum = config.default_thread_size_ + config.secondary_thread_size_;
CGRAPH_THROW_EXCEPTION_BY_CONDITION(thdNum <= 0,
"default thread size cannot smaller than 1");

std::vector<std::future<CStatus>> futures;
CSize taskNumPerThd = total_end_size_ / thdNum + (CSize)(0 != total_end_size_ % thdNum);
for (int i = 0; i < thdNum; i++) {
GElementPtrArr elements;
for (int j = 0; j < taskNumPerThd; j++) {
auto cur = i * taskNumPerThd + j;
if (cur < total_end_size_) {
elements.emplace_back(front_element_arr_[cur]);
}
}
for (auto& elements : parallel_element_matrix_) {
auto curFut = thread_pool_->commit([elements] {
CGRAPH_FUNCTION_BEGIN
for (auto* element : elements) {
Expand All @@ -236,17 +223,19 @@ CVoid GDynamicEngine::parallelRunAll() {
#else
CVoid GDynamicEngine::parallelRunAll() {
parallel_run_num_ = 0;
for (int i = 0; i < parallel_element_matrix_.size(); i++) {
for (CIndex i = 0; i < (CIndex)parallel_element_matrix_.size(); i++) {
const auto& curArr = parallel_element_matrix_[i];
for (auto element : curArr) {
thread_pool_->executeWithTid([this, element] {
parallelRunOne(element); },
1 == parallel_element_matrix_.size() ? CGRAPH_SECONDARY_THREAD_COMMON_ID : i,
element == curArr.front() || element == curArr.back(),
element == curArr.front());
thread_pool_->executeWithTid([this, element] { parallelRunOne(element); }, i,
element == curArr.front() || element == curArr.back(),
element == curArr.front());
}
}
thread_pool_->wakeupAllThread();

if (parallel_element_matrix_.size() < (CSize)(thread_pool_->getConfig().default_thread_size_)) {
// 确保所有的 pt 都可以被唤醒,从而快速执行
thread_pool_->wakeupAllThread();
}

{
CGRAPH_UNIQUE_LOCK lock(locker_.mtx_);
Expand Down
Loading