dbcsr_acc_set_active_device Subroutine

public subroutine dbcsr_acc_set_active_device(device_id)

Set active accelerator device

Arguments

Type IntentOptional Attributes Name
integer :: device_id

Source Code

   SUBROUTINE dbcsr_acc_set_active_device(device_id)
      !! Set active accelerator device

      INTEGER :: device_id

#if defined (__DBCSR_ACC)
      INTEGER :: istat

!$    IF (0 == omp_get_level()) THEN
         istat = 0
!$OMP    PARALLEL DEFAULT(NONE) SHARED(device_id) REDUCTION(MAX:istat)
         istat = acc_set_active_device_cu(device_id)
!$OMP    END PARALLEL
!$    ELSE
         istat = acc_set_active_device_cu(device_id)
!$    END IF
      IF (istat /= 0) &
         DBCSR_ABORT("dbcsr_acc_set_active_device: failed")

#else
      MARK_USED(device_id)
      DBCSR_ABORT("__DBCSR_ACC not compiled in")
#endif
   END SUBROUTINE dbcsr_acc_set_active_device