1) Calling PetscOptions inside threads. I looked quickly at the code and it seems like it should be ok but perhaps not. This is one reason why having stuff like PetscOptionsBegin inside a low-level creation VecCreate_SeqCUDA_Private is normally not done in PETSc. Eventually this needs to be moved or reworked.
2) PetscCUDAInitializeCheck is not thread safe.If it is being call for the first timeby multiple threads there can be trouble. So edit init.c and under
#if defined(PETSC_HAVE_CUDA)
ierr = PetscOptionsCheckCUDA(logView);CHKERRQ(ierr);
#endif
#if defined(PETSC_HAVE_HIP)
ierr = PetscOptionsCheckHIP(logView);CHKERRQ(ierr);
#endif
put in
#if defined thread safety
PetscCUPMInitializeCheck
#endif
this will force the initialize to be done before any threads are used