1 static const char help[] = "Tests PetscDeviceGetAttribute().\n\n"; 2 3 #include <petsc/private/deviceimpl.h> 4 #include "petscdevicetestcommon.h" 5 #include <petscviewer.h> 6 7 int main(int argc, char *argv[]) { 8 PetscDevice device = NULL; 9 size_t shmem = 0; 10 11 PetscFunctionBeginUser; 12 PetscCall(PetscInitialize(&argc, &argv, NULL, help)); 13 14 PetscCall(PetscDeviceCreate(PETSC_DEVICE_DEFAULT, PETSC_DECIDE, &device)); 15 PetscCall(PetscDeviceConfigure(device)); 16 PetscCall(PetscDeviceGetAttribute(device, PETSC_DEVICE_ATTR_SIZE_T_SHARED_MEM_PER_BLOCK, &shmem)); 17 if (shmem == 0 || shmem == (size_t)-1) { 18 PetscCall(PetscDeviceView(device, PETSC_VIEWER_STDOUT_SELF)); 19 SETERRQ(PETSC_COMM_SELF, PETSC_ERR_LIB, "Maximum shared memory of %zu seems fishy", shmem); 20 } 21 PetscCall(PetscDeviceDestroy(&device)); 22 23 PetscCall(PetscPrintf(PETSC_COMM_WORLD, "EXIT_SUCCESS\n")); 24 PetscCall(PetscFinalize()); 25 return 0; 26 } 27 28 /*TEST 29 30 build: 31 requires: defined(PETSC_HAVE_CXX) 32 33 testset: 34 TODO: broken in ci 35 requires: !device 36 suffix: no_device 37 filter: Error: grep -E -o -e ".*No support for this operation for this object type" -e ".*PETSc is not configured with device support.*" -e "^\[0\]PETSC ERROR:.*[0-9]{1} [A-z]+\(\)" 38 test: 39 requires: debug 40 suffix: debug 41 test: 42 requires: !debug 43 suffix: opt 44 45 testset: 46 output_file: ./output/ExitSuccess.out 47 test: 48 requires: cuda 49 suffix: cuda 50 test: 51 requires: hip 52 suffix: hip 53 test: 54 requires: sycl 55 suffix: sycl 56 57 TEST*/ 58