Actual source code: hostdevice.cxx
1: #include "hostdevice.hpp"
3: namespace Petsc
4: {
6: namespace device
7: {
9: namespace host
10: {
12: PetscErrorCode Device::initialize(MPI_Comm comm, PetscInt *defaultDeviceId, PetscBool *defaultView, PetscDeviceInitType *defaultInitType) noexcept
13: {
14: // the host is always id 0
15: *defaultDeviceId = 0;
16: // the host is always "lazily" initialized
17: *defaultInitType = PETSC_DEVICE_INIT_LAZY;
19: PetscOptionsBegin(comm, nullptr, "PetscDevice host Options", "Sys");
20: base_type::PetscOptionDeviceView(PetscOptionsObject, defaultView, nullptr);
21: PetscOptionsEnd();
22: return 0;
23: }
25: PetscErrorCode Device::get_attribute_(PetscInt, PetscDeviceAttribute attr, void *value) noexcept
26: {
27: switch (attr) {
28: case PETSC_DEVICE_ATTR_SIZE_T_SHARED_MEM_PER_BLOCK:
29: *static_cast<std::size_t *>(value) = 64000;
30: break;
31: default:
32: PetscUnreachable();
33: }
34: return 0;
35: }
37: } // namespace host
39: } // namespace device
41: } // namespace Petsc