diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53a58c25de..af82d53fde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,7 +153,7 @@ jobs: wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt-get update - sudo apt-get install -y cuda-command-line-tools-12-6 cuda-compiler-12-6 cuda-minimal-build-12-6 cuda-nvml-dev-12-6 cuda-nvtx-12-6 libcurand-dev-12-6 cuda-cupti-dev-12-6 + sudo apt-get install -y cuda-command-line-tools-12-6 cuda-compiler-12-6 cuda-minimal-build-12-6 cuda-nvml-dev-12-6 cuda-nvtx-12-6 libcurand-dev-12-6 cuda-cupti-dev-12-6 libcusparse-dev-12-6 - name: Configure and build run: | export PATH=/usr/local/nvidia/bin:/usr/local/cuda-12.6/bin:${PATH} @@ -212,7 +212,7 @@ jobs: echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600 echo 'export PATH=/opt/rocm/llvm/bin:/opt/rocm/bin:/opt/rocm/profiler/bin:/opt/rocm/opencl/bin:$PATH' | sudo tee -a /etc/profile.d/rocm.sh sudo apt-get update - sudo apt-get install -y --no-install-recommends build-essential rocm-dev rocrand-dev rocprim-dev hiprand-dev + sudo apt-get install -y --no-install-recommends build-essential rocm-dev rocrand-dev rocprim-dev hiprand-dev rocsparse-dev - name: Configure and build run: | source /etc/profile.d/rocm.sh diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ad608dfd9d..dd30697bb5 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -53,10 +53,10 @@ jobs: cat build-output-warnings.txt exit $(tail -n 1 build-output-warnings.txt | awk '{print $2}') - name: Deploy - if: github.event_name == 'push' - uses: JamesIves/github-pages-deploy-action@releases/v3 + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: JamesIves/github-pages-deploy-action@releases/v4 with: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - BRANCH: gh-pages - FOLDER: documentation - SINGLE_COMMIT: true + token: ${{secrets.GITHUB_TOKEN}} + branch: gh-pages + folder: documentation + single-commit: true diff --git a/amr-wind/utilities/index_operations.H b/amr-wind/utilities/index_operations.H index 24b9a44649..c5314cded3 100644 --- a/amr-wind/utilities/index_operations.H +++ b/amr-wind/utilities/index_operations.H @@ -10,10 +10,16 @@ namespace amr_wind::utils { //! Return closest index (from lower) of value in vector -AMREX_FORCE_INLINE int -closest_index(const amrex::Vector& vec, const amrex::Real value) +AMREX_FORCE_INLINE int closest_index( + const amrex::Vector& vec, + const amrex::Real value, + const amrex::Real tol = 0.0) { - auto const it = std::upper_bound(vec.begin(), vec.end(), value); + auto it = std::upper_bound(vec.begin(), vec.end(), value); + if (it == vec.end()) { + // Try again with tolerance added + it = std::upper_bound(vec.begin(), vec.end(), value - tol); + } AMREX_ALWAYS_ASSERT(it != vec.end()); const int idx = static_cast(std::distance(vec.begin(), it)); diff --git a/amr-wind/wind_energy/ABLBoundaryPlane.cpp b/amr-wind/wind_energy/ABLBoundaryPlane.cpp index 67c20a7a4f..ba31d352fc 100644 --- a/amr-wind/wind_energy/ABLBoundaryPlane.cpp +++ b/amr-wind/wind_energy/ABLBoundaryPlane.cpp @@ -78,11 +78,13 @@ void InletData::read_data( const size_t nc = fld->num_comp(); const int nstart = m_components[static_cast(fld->id())]; - const int idx = utils::closest_index(times, time); + const int idx = utils::closest_index(times, time, constants::LOOSE_TOL); const int idxp1 = idx + 1; m_tn = times[idx]; m_tnp1 = times[idxp1]; - AMREX_ALWAYS_ASSERT(((m_tn <= time) && (time <= m_tnp1))); + AMREX_ALWAYS_ASSERT( + ((m_tn <= time + constants::LOOSE_TOL) && + (time <= m_tnp1 + constants::LOOSE_TOL))); const int normal = ori.coordDir(); const amrex::GpuArray perp = utils::perpendicular_idx(normal); @@ -152,7 +154,7 @@ void InletData::read_data_native( const int nstart = static_cast(m_components[static_cast(fld->id())]); - const int idx = utils::closest_index(times, time); + const int idx = utils::closest_index(times, time, constants::LOOSE_TOL); const int idxp1 = idx + 1; m_tn = times[idx]; @@ -160,7 +162,9 @@ void InletData::read_data_native( auto ori = oit(); - AMREX_ALWAYS_ASSERT(((m_tn <= time) && (time <= m_tnp1))); + AMREX_ALWAYS_ASSERT( + ((m_tn <= time + constants::LOOSE_TOL) && + (time <= m_tnp1 + constants::LOOSE_TOL))); AMREX_ALWAYS_ASSERT(fld->num_comp() == bndry_n[ori].nComp()); AMREX_ASSERT(bndry_n[ori].boxArray() == bndry_np1[ori].boxArray()); @@ -711,7 +715,8 @@ void ABLBoundaryPlane::read_header() ncf.var("time").get(m_in_times.data()); // Sanity check the input file time - AMREX_ALWAYS_ASSERT(m_in_times[0] <= m_time.current_time()); + AMREX_ALWAYS_ASSERT( + m_in_times[0] <= m_time.current_time() + constants::LOOSE_TOL); for (auto& plane_grp : ncf.all_groups()) { int normal, face_dir; @@ -1042,7 +1047,9 @@ void ABLBoundaryPlane::read_file(const bool nph_target_time) const amrex::Real time = nph_target_time ? m_time.current_time() + 0.5 * m_time.delta_t() : m_time.new_time(); - AMREX_ALWAYS_ASSERT((m_in_times[0] <= time) && (time < m_in_times.back())); + AMREX_ALWAYS_ASSERT( + (m_in_times[0] <= time + constants::LOOSE_TOL) && + (time < m_in_times.back() + constants::LOOSE_TOL)); // return early if current data files can still be interpolated in time if ((m_in_data.tn() <= time) && (time < m_in_data.tnp1())) { @@ -1078,12 +1085,14 @@ void ABLBoundaryPlane::read_file(const bool nph_target_time) if (m_out_fmt == "native") { - const int index = utils::closest_index(m_in_times, time); + const int index = + utils::closest_index(m_in_times, time, constants::LOOSE_TOL); const int t_step1 = m_in_timesteps[index]; const int t_step2 = m_in_timesteps[index + 1]; AMREX_ALWAYS_ASSERT( - (m_in_times[index] <= time) && (time <= m_in_times[index + 1])); + (m_in_times[index] <= time + constants::LOOSE_TOL) && + (time <= m_in_times[index + 1] + constants::LOOSE_TOL)); const std::string chkname1 = m_filename + amrex::Concatenate("/bndry_output", t_step1); @@ -1161,9 +1170,10 @@ void ABLBoundaryPlane::populate_data( } AMREX_ALWAYS_ASSERT( - ((m_in_data.tn() <= time) || (time <= m_in_data.tnp1()))); + ((m_in_data.tn() <= time - constants::LOOSE_TOL) || + (time <= m_in_data.tnp1() - constants::LOOSE_TOL))); AMREX_ALWAYS_ASSERT( - std::abs(time - m_in_data.tinterp()) < constants::TIGHT_TOL); + std::abs(time - m_in_data.tinterp()) < constants::LOOSE_TOL); for (amrex::OrientationIter oit; oit != nullptr; ++oit) { auto ori = oit(); diff --git a/submods/amrex b/submods/amrex index 4a3a5ff905..9643da4522 160000 --- a/submods/amrex +++ b/submods/amrex @@ -1 +1 @@ -Subproject commit 4a3a5ff9052afb70bcacc3ac5e7ed557653bf11a +Subproject commit 9643da4522f955767ab78bc03abe206d238f8949