Base infrastructure plus gpu locking/allocating routines