Lines Matching refs:device
16 using namespace Petsc::device;
102 PetscErrorCode PetscDeviceCreate(PetscDeviceType type, PetscInt devid, PetscDevice *device) in PetscDeviceCreate() argument
108 PetscAssertPointer(device, 3); in PetscDeviceCreate()
111 PetscCall(PetscNew(device)); in PetscDeviceCreate()
112 (*device)->id = PetscDeviceCounter++; in PetscDeviceCreate()
113 (*device)->type = type; in PetscDeviceCreate()
114 (*device)->refcnt = 1; in PetscDeviceCreate()
120 PETSC_DEVICE_CASE_IF_PETSC_DEFINED(HOST, getDevice, *device, devid); in PetscDeviceCreate()
121 PETSC_DEVICE_CASE_IF_PETSC_DEFINED(CUDA, getDevice, *device, devid); in PetscDeviceCreate()
122 PETSC_DEVICE_CASE_IF_PETSC_DEFINED(HIP, getDevice, *device, devid); in PetscDeviceCreate()
123 PETSC_DEVICE_CASE_IF_PETSC_DEFINED(SYCL, getDevice, *device, devid); in PetscDeviceCreate()
145 PetscErrorCode PetscDeviceDestroy(PetscDevice *device) in PetscDeviceDestroy() argument
148 PetscAssertPointer(device, 1); in PetscDeviceDestroy()
149 if (!*device) PetscFunctionReturn(PETSC_SUCCESS); in PetscDeviceDestroy()
150 PetscValidDevice(*device, 1); in PetscDeviceDestroy()
151 PetscCall(PetscDeviceDereference_Internal(*device)); in PetscDeviceDestroy()
152 if ((*device)->refcnt) { in PetscDeviceDestroy()
153 *device = nullptr; in PetscDeviceDestroy()
156 PetscCall(PetscFree((*device)->data)); in PetscDeviceDestroy()
157 PetscCall(PetscFree(*device)); in PetscDeviceDestroy()
177 PetscErrorCode PetscDeviceConfigure(PetscDevice device) in PetscDeviceConfigure() argument
180 PetscValidDevice(device, 1); in PetscDeviceConfigure()
185 switch (const auto dtype = device->type) { in PetscDeviceConfigure()
201 PetscUseTypeMethod(device, configure); in PetscDeviceConfigure()
219 PetscErrorCode PetscDeviceView(PetscDevice device, PetscViewer viewer) in PetscDeviceView() argument
225 PetscValidDevice(device, 1); in PetscDeviceView()
243 PetscCall(PetscDeviceGetDeviceId(device, &id)); in PetscDeviceView()
244 PetscCall(PetscDeviceGetType(device, &dtype)); in PetscDeviceView()
253 PetscTryTypeMethod(device, view, sub); in PetscDeviceView()
280 PetscErrorCode PetscDeviceGetType(PetscDevice device, PetscDeviceType *type) in PetscDeviceGetType() argument
283 PetscValidDevice(device, 1); in PetscDeviceGetType()
285 *type = device->type; in PetscDeviceGetType()
309 PetscErrorCode PetscDeviceGetDeviceId(PetscDevice device, PetscInt *id) in PetscDeviceGetDeviceId() argument
312 PetscValidDevice(device, 1); in PetscDeviceGetDeviceId()
314 *id = device->deviceId; in PetscDeviceGetDeviceId()
459 PetscErrorCode PetscDeviceGetDefaultForType_Internal(PetscDeviceType type, PetscDevice *device) in PetscDeviceGetDefaultForType_Internal() argument
462 PetscAssertPointer(device, 2); in PetscDeviceGetDefaultForType_Internal()
464 *device = defaultDevices[type].first; in PetscDeviceGetDefaultForType_Internal()
490 PetscErrorCode PetscDeviceGetAttribute(PetscDevice device, PetscDeviceAttribute attr, void *value) in PetscDeviceGetAttribute() argument
493 PetscValidDevice(device, 1); in PetscDeviceGetAttribute()
496 PetscUseTypeMethod(device, getattribute, attr, value); in PetscDeviceGetAttribute()
593 for (auto &&device : defaultDevices) { in PetscDeviceFinalize_Private()
594 const auto dev = device.first; in PetscDeviceFinalize_Private()
601 for (auto &&device : defaultDevices) { in PetscDeviceFinalize_Private()
602 PetscCall(PetscDeviceDestroy(&device.first)); in PetscDeviceFinalize_Private()
603 device.second = false; in PetscDeviceFinalize_Private()