guard gpu resource by RAII