@@ -40,29 +40,6 @@ int main(int argc, char **argv) {
4040 // ---------------------------------------------------------------------------
4141 PetscCall ( PetscInitialize (& argc , & argv , NULL , help ) );
4242
43- // ---------------------------------------------------------------------------
44- // Initialize libCEED
45- // ---------------------------------------------------------------------------
46- // -- Initialize backend
47- Ceed ceed ;
48- CeedInit ("/cpu/self/ref/serial" , & ceed );
49- CeedMemType mem_type_backend ;
50- CeedGetPreferredMemType (ceed , & mem_type_backend );
51-
52- VecType vec_type = NULL ;
53- switch (mem_type_backend ) {
54- case CEED_MEM_HOST : vec_type = VECSTANDARD ; break ;
55- case CEED_MEM_DEVICE : {
56- const char * resolved ;
57- CeedGetResource (ceed , & resolved );
58- if (strstr (resolved , "/gpu/cuda" )) vec_type = VECCUDA ;
59- else if (strstr (resolved , "/gpu/hip/occa" ))
60- vec_type = VECSTANDARD ; // https://github.com/CEED/libCEED/issues/678
61- else if (strstr (resolved , "/gpu/hip" )) vec_type = VECHIP ;
62- else vec_type = VECSTANDARD ;
63- }
64- }
65-
6643 // ---------------------------------------------------------------------------
6744 // Create structs
6845 // ---------------------------------------------------------------------------
@@ -101,6 +78,30 @@ int main(int argc, char **argv) {
10178 app_ctx -> ctx_Hdiv = ctx_Hdiv ;
10279 app_ctx -> ctx_H1 = ctx_H1 ;
10380
81+ // ---------------------------------------------------------------------------
82+ // Initialize libCEED
83+ // ---------------------------------------------------------------------------
84+ // -- Initialize backend
85+ Ceed ceed ;
86+ //CeedInit("/cpu/self/ref/serial", &ceed);
87+ CeedInit (app_ctx -> ceed_resource , & ceed );
88+ CeedMemType mem_type_backend ;
89+ CeedGetPreferredMemType (ceed , & mem_type_backend );
90+
91+ VecType vec_type = NULL ;
92+ switch (mem_type_backend ) {
93+ case CEED_MEM_HOST : vec_type = VECSTANDARD ; break ;
94+ case CEED_MEM_DEVICE : {
95+ const char * resolved ;
96+ CeedGetResource (ceed , & resolved );
97+ if (strstr (resolved , "/gpu/cuda" )) vec_type = VECCUDA ;
98+ else if (strstr (resolved , "/gpu/hip/occa" ))
99+ vec_type = VECSTANDARD ; // https://github.com/CEED/libCEED/issues/678
100+ else if (strstr (resolved , "/gpu/hip" )) vec_type = VECHIP ;
101+ else vec_type = VECSTANDARD ;
102+ }
103+ }
104+
104105 // -- Process general command line options
105106 MPI_Comm comm = PETSC_COMM_WORLD ;
106107 // ---------------------------------------------------------------------------
0 commit comments