Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pencilcaseman committed Feb 22, 2023
1 parent 01af295 commit 9018d7e
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 57 deletions.
103 changes: 52 additions & 51 deletions .github/workflows/code-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,51 +1,52 @@
name: Code Coverage

on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
workflow_dispatch:

jobs:
check-quality:
runs-on: ubuntu-latest
name: Code Coverage
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Install Requirements
run: |
sudo apt-get install libgomp1
- name: Compile LibRapid
run: |
mkdir build
cd build
cmake .. -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_GET_BLAS=on -DLIBRAPID_USE_MULTIPREC=on -DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_BUILD_TYPE=Debug
cmake --build . --parallel
env:
CC: gcc-9
CXX: g++-9

- name: Run Executable
run: |
cd build
ctest -C Release --output-on-failure
- name: Run Code Coverage
uses: codecov/codecov-action@v3
with:
verbose: true

- name: Upload Code Coverage Results
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov
# name: Code Coverage
#
# on:
# push:
# branches:
# - "**"
# pull_request:
# branches:
# - "**"
# workflow_dispatch:
#
# jobs:
# check-quality:
# runs-on: ubuntu-latest
# name: Code Coverage
# steps:
# - name: Checkout Code
# uses: actions/checkout@v3
# with:
# submodules: recursive
# ref: ${{ steps.extract_branch.outputs.branch }}
#
# - name: Install Requirements
# run: |
# sudo apt-get install libgomp1
#
# - name: Compile LibRapid
# run: |
# mkdir build
# cd build
# cmake .. -DLIBRAPID_BUILD_TESTS=on -DLIBRAPID_GET_BLAS=on -DLIBRAPID_USE_MULTIPREC=on -DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_BUILD_TYPE=Debug
# cmake --build . --parallel
# env:
# CC: gcc-9
# CXX: g++-9
#
# - name: Run Executable
# run: |
# cd build
# ctest -C Release --output-on-failure
#
# - name: Run Code Coverage
# uses: codecov/codecov-action@v3
# with:
# verbose: true
#
# - name: Upload Code Coverage Results
# run: |
# curl -Os https://uploader.codecov.io/latest/linux/codecov
# chmod +x codecov
# ./codecov
#
18 changes: 12 additions & 6 deletions librapid/include/librapid/array/cudaStorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ namespace librapid {

template<typename T>
CudaStorage<T>::CudaStorage(const CudaStorage &other) {
m_begin = detail::cudaSharedPtrAllocate<T>(other.size());
m_size = other.size();
m_begin = detail::cudaSharedPtrAllocate<T>(other.size());
m_size = other.size();
m_independent = other.m_independent;
cudaSafeCall(cudaMemcpyAsync(m_begin.get(),
other.begin().get(),
Expand Down Expand Up @@ -371,11 +371,17 @@ namespace librapid {
template<typename T>
template<typename P>
void CudaStorage<T>::initData(P begin, P end) {
auto size = std::distance(begin, end);
m_begin = detail::cudaSharedPtrAllocate<T>(size);
m_size = size;
auto size = std::distance(begin, end);
m_begin = detail::cudaSharedPtrAllocate<T>(size);
m_size = size;
auto tmpBegin = [begin]() {
if constexpr (std::is_pointer_v<P>)
return begin;
else
return &(*begin);
}();
cudaSafeCall(cudaMemcpyAsync(
m_begin.get(), begin, sizeof(T) * size, cudaMemcpyDefault, global::cudaStream));
m_begin.get(), tmpBegin, sizeof(T) * size, cudaMemcpyDefault, global::cudaStream));
}

template<typename T>
Expand Down

0 comments on commit 9018d7e

Please sign in to comment.