[libcxx-commits] [libcxx] [libcxxabi] [llvm] Adding Separate OpenMP Offloading Backend to `libcxx/include/__algorithm/pstl_backends` (PR #66968)

Vidush Singhal via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 5 15:21:16 PST 2024


vidsinghal wrote:

Hi I am trying to compile a simple fill example with this LLVM version, with the hope of offloading it to the GPU. 
Here is my code 

```
#include <iostream>
#include <vector>
#include <algorithm>
#include <execution>

void test_fill(std::vector<int> *v) {
                std::fill(v->begin(), v->end(), 0);
}

int add(int x){
    return x + 1;
}


int main() {

    int arraySize = 100000; 
    std::vector<int> *A = new std::vector<int>(arraySize);
    test_fill(A);
    delete A;
}
```
I compile it with the following command: 
```
clang++ -std=c++17 -g --hipstdpar --offload-arch=native --hipstdpar-interpose-alloc --hip-link -frtlib-add-rpath find.cpp -o fill_gpu_offload
```

I get the following error 
```
../../../../../libstdc++-v3/src/nonshared17/../c++17/memory_resource.cc:1030: void std::pmr::__pool_resource::deallocate(void*, std::size_t, std::size_t): Assertion 'it != _M_unpooled.end() && it->pointer == p' failed.
Aborted (core dumped)
```








https://github.com/llvm/llvm-project/pull/66968


More information about the libcxx-commits mailing list