@@ -40,29 +40,6 @@ int main(int argc, char **argv) {
40
40
// ---------------------------------------------------------------------------
41
41
PetscCall ( PetscInitialize (& argc , & argv , NULL , help ) );
42
42
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
-
66
43
// ---------------------------------------------------------------------------
67
44
// Create structs
68
45
// ---------------------------------------------------------------------------
@@ -101,6 +78,30 @@ int main(int argc, char **argv) {
101
78
app_ctx -> ctx_Hdiv = ctx_Hdiv ;
102
79
app_ctx -> ctx_H1 = ctx_H1 ;
103
80
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
+
104
105
// -- Process general command line options
105
106
MPI_Comm comm = PETSC_COMM_WORLD ;
106
107
// ---------------------------------------------------------------------------
0 commit comments