Skip to content

Commit d816fd1

Browse files
authored
Add index and size information to Vector assertion message (#4790)
1 parent 2edc538 commit d816fd1

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

.github/workflows/gcc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ jobs:
311311
restore-keys: |
312312
ccache-${{ github.workflow }}-${{ github.job }}-git-
313313
- name: Build & Install
314-
env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wnon-virtual-dtor -Wlogical-op -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wmissing-include-dirs -Wno-array-bounds"}
314+
env: {CXXFLAGS: "-fno-operator-names -Werror -Wall -Wextra -Wpedantic -Wnull-dereference -Wfloat-conversion -Wshadow -Woverloaded-virtual -Wnon-virtual-dtor -Wlogical-op -Wmisleading-indentation -Wduplicated-cond -Wduplicated-branches -Wmissing-include-dirs -Wno-array-bounds -Wno-maybe-uninitialized"}
315315
run: |
316316
export CCACHE_COMPRESS=1
317317
export CCACHE_COMPRESSLEVEL=10

.github/workflows/trigger-hpsf-gitlab-ci.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@ jobs:
3737
MERGE_REF="${{ steps.setref.outputs.merge_ref }}"
3838
echo "Triggering GitLab pipeline for ref: $MERGE_REF"
3939
40+
GITHUB_PIPELINE_NAME="GitHub #${{ github.event.issue.number }}: ${{ steps.setref.outputs.pr_title }}"
41+
4042
RESPONSE=$(curl -s -X POST \
4143
-F token=${{ secrets.HPSF_GITLAB_TRIGGER_TOKEN }} \
4244
-F ref=development \
4345
-F "variables[GITHUB_PR_NUMBER]=${{ github.event.issue.number }}" \
4446
-F "variables[GITHUB_MERGE_REF]=refs/pull/${{ github.event.issue.number }}/merge" \
4547
-F "variables[GITHUB_TRIGGER_ACTOR]=${{ github.actor }}" \
4648
-F "variables[GITHUB_PR_TITLE]=${{ steps.setref.outputs.pr_title }}" \
49+
-F "variables[GITHUB_PIPELINE_NAME]=${GITHUB_PIPELINE_NAME}" \
4750
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/trigger/pipeline")
4851
4952
echo "GitLab response: $RESPONSE"
@@ -60,15 +63,6 @@ jobs:
6063
echo "pipeline_url=$PIPELINE_URL" >> $GITHUB_OUTPUT
6164
echo "pipeline_id=$PIPELINE_ID" >> $GITHUB_OUTPUT
6265
63-
# Update pipeline name
64-
PIPELINE_NAME="GitHub #${{ github.event.issue.number }}: ${{ steps.setref.outputs.pr_title }}"
65-
curl --request PUT \
66-
--header "PRIVATE-TOKEN: ${{ secrets.HPSF_GITLAB_API_TOKEN }}" \
67-
--data-urlencode "name=${PIPELINE_NAME}" \
68-
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/pipelines/${PIPELINE_ID}/metadata"
69-
|| echo "Warning: Failed to update pipline name (possibly expired token)"
70-
echo "Updated pipeline name to: $PIPELINE_NAME"
71-
7266
- name: Post status to GitHub PR
7367
shell: bash
7468
run: |
@@ -90,7 +84,7 @@ jobs:
9084
echo "Waiting on GitLab pipeline $PIPELINE_ID..."
9185
9286
STATUS="running"
93-
MAX_WAIT=14400 # 4 hours
87+
MAX_WAIT=86400 # 24 hours
9488
ELAPSED=0
9589
9690
while [[ "$STATUS" == "running" || "$STATUS" == "pending" ]]; do
@@ -100,8 +94,13 @@ jobs:
10094
exit 1
10195
fi
10296
103-
sleep 300
104-
ELAPSED=$((ELAPSED + 300))
97+
if [ $ELAPSED -lt 7200 ]; then
98+
SLEEP_TIME=600 # 10 minutes
99+
else
100+
SLEEP_TIME=3600 # 1 hour
101+
fi
102+
sleep $SLEEP_TIME
103+
ELAPSED=$((ELAPSED + SLEEP_TIME))
105104
106105
STATUS=$(curl -s \
107106
"https://gitlab.spack.io/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/pipelines/$PIPELINE_ID" \

.gitlab/hpsf-gitlab-ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
workflow:
2+
name: '$GITHUB_PIPELINE_NAME'
3+
14
.dependency-n-fetch-pr:
25
stage: test
36
before_script:
@@ -10,7 +13,7 @@
1013
echo "GITHUB_PR_TITLE=$GITHUB_PR_TITLE"
1114
git remote add github https://github.com/amrex-codes/amrex.git
1215
git fetch --depth=1 github "${GITHUB_MERGE_REF}"
13-
git checkout FETCH_HEAD -b pr-${GITHUB_PR_NUMBER}
16+
git checkout FETCH_HEAD
1417
fi
1518
1619
Nvidia-H100-single-precision:
@@ -81,7 +84,6 @@ Intel-PVC:
8184
- |
8285
cmake -S . -B build \
8386
-DCMAKE_VERBOSE_MAKEFILE=ON \
84-
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
8587
-DAMReX_MPI=OFF \
8688
-DAMReX_SPACEDIM="1;2;3" \
8789
-DAMReX_FFT=ON \
@@ -91,6 +93,7 @@ Intel-PVC:
9193
-DAMReX_GPU_BACKEND=SYCL \
9294
-DCMAKE_C_COMPILER=$(which icx) \
9395
-DCMAKE_CXX_COMPILER=$(which icpx) \
96+
-DCMAKE_CXX_FLAGS="-fp-model=precise" \
9497
-DAMReX_PARALLEL_LINK_JOBS=8
9598
- cmake --build build -j 16
9699
- export AMREX_THE_ARENA_INIT_SIZE=1e9

Src/Base/AMReX_Vector.H

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <algorithm>
1414
#include <memory>
15+
#include <string>
1516
#include <vector>
1617

1718
namespace amrex {
@@ -32,13 +33,15 @@ public:
3233

3334
[[nodiscard]] T& operator[] (size_type i) noexcept
3435
{
35-
BL_ASSERT( i < (this->std::vector<T, Allocator>::size()) );
36+
AMREX_ASSERT_WITH_MESSAGE(i < (this->std::vector<T, Allocator>::size()),
37+
"Out of bound error, index: " + std::to_string(i) + " size: " + std::to_string(size()));
3638
return this->std::vector<T, Allocator>::operator[](i);
3739
}
3840

3941
[[nodiscard]] const T& operator[] (size_type i) const noexcept
4042
{
41-
BL_ASSERT( i < (this->std::vector<T, Allocator>::size()) );
43+
AMREX_ASSERT_WITH_MESSAGE(i < (this->std::vector<T, Allocator>::size()),
44+
"Out of bound error, index: " + std::to_string(i) + " size: " + std::to_string(size()));
4245
return this->std::vector<T, Allocator>::operator[](i);
4346
}
4447

0 commit comments

Comments
 (0)