# I failed to set options for PETSc compiled with CUDA

**URL:** https://fenicsproject.discourse.group/t/i-failed-to-set-options-for-petsc-compiled-with-cuda/4085
**Category:** Uncategorized
**Created:** [September 12, 2020, 3:04pm UTC](https://fenicsproject.discourse.group/t/i-failed-to-set-options-for-petsc-compiled-with-cuda/4085 "2020-09-12T15:04:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mapengfei-nwpu](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/mapengfei-nwpu/32/117_2.png) [@mapengfei-nwpu](https://fenicsproject.discourse.group/u/mapengfei-nwpu)
#### Post date: [September 12, 2020, 3:04pm UTC](https://fenicsproject.discourse.group/t/i-failed-to-set-options-for-petsc-compiled-with-cuda/4085/1 "2020-09-12T15:04:43Z")

</div>

I have successfully compiled PETSc with CUDA and tested the official example `petsc/src/ksp/ksp/tutorials/ex12` with the following command.

```auto
ex12 -n 200 -m 200 -pc_type none -vec_type cuda -mat_type aijcusparse

```

I can see the GPU memory allocated and the speeding up. Then, I compiled dolfin with this PETSc. However, when I tested demo poisson by adding the following codes:

```auto
PETScOptions.set("-mat_type", "aijcusparse");
PETScOptions.set("-vec_type", "cuda");

```

the GPU didn’t work. The program still ran on the CPU. Is any other options should be set to call the GPU API?
