Skip to content

Commit bc0cf4a

Browse files
authored
Merge pull request #1952 from CEED/zach/multi-basis-rstr-assembly
Add support for fully assembling operators with multiple active fields with different bases
2 parents 0414a02 + 5388e7c commit bc0cf4a

24 files changed

Lines changed: 2583 additions & 292 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Specifically, directories set with `CeedAddJitSourceRoot(ceed, "foo/bar")` will
3030
- Added support to code generation backends `/gpu/cuda/gen` and `/gpu/hip/gen` for operators with both tensor and non-tensor bases.
3131
- Add `CeedGetGitVersion()` to access the Git commit and dirty state of the repository at build time.
3232
- Add `CeedGetBuildConfiguration()` to access compilers, flags, and related information about the build environment.
33+
- Add support for full `CeedOperator` assembly for operators with multiple active fields with different bases for CPU backends and `/gpu/cuda/ref` and `/gpu/hip/gen` backends.
3334

3435
### Examples
3536

backends/cuda-gen/ceed-cuda-gen-operator-build.cpp

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,10 @@ static int CeedOperatorBuildKernelFieldData_Cuda_gen(std::ostringstream &code, C
367367
break;
368368
case CEED_EVAL_WEIGHT:
369369
break; // No action
370-
// LCOV_EXCL_START
371370
case CEED_EVAL_DIV:
372371
case CEED_EVAL_CURL:
372+
data->use_fallback = true;
373373
break; // TODO: Not implemented
374-
// LCOV_EXCL_STOP
375374
}
376375
CeedCallBackend(CeedBasisDestroy(&basis));
377376
return CEED_ERROR_SUCCESS;
@@ -459,11 +458,10 @@ static int CeedOperatorBuildKernelRestriction_Cuda_gen(std::ostringstream &code,
459458
data->indices.inputs[i] = (CeedInt *)rstr_data->d_offsets;
460459
break;
461460
}
462-
// LCOV_EXCL_START
463461
case CEED_RESTRICTION_ORIENTED:
464462
case CEED_RESTRICTION_CURL_ORIENTED:
463+
data->use_fallback = true;
465464
break; // TODO: Not implemented
466-
// LCOV_EXCL_STOP
467465
}
468466
}
469467
} else {
@@ -511,11 +509,10 @@ static int CeedOperatorBuildKernelRestriction_Cuda_gen(std::ostringstream &code,
511509
case CEED_RESTRICTION_POINTS:
512510
data->indices.outputs[i] = (CeedInt *)rstr_data->d_offsets;
513511
break;
514-
// LCOV_EXCL_START
515512
case CEED_RESTRICTION_ORIENTED:
516513
case CEED_RESTRICTION_CURL_ORIENTED:
514+
data->use_fallback = true;
517515
break; // TODO: Not implemented
518-
// LCOV_EXCL_STOP
519516
}
520517
}
521518
CeedCallBackend(CeedElemRestrictionDestroy(&elem_rstr));
@@ -630,11 +627,10 @@ static int CeedOperatorBuildKernelBasis_Cuda_gen(std::ostringstream &code, CeedO
630627
}
631628
break;
632629
}
633-
// LCOV_EXCL_START
634630
case CEED_EVAL_DIV:
635631
case CEED_EVAL_CURL:
632+
data->use_fallback = true;
636633
break; // TODO: Not implemented
637-
// LCOV_EXCL_STOP
638634
}
639635
} else {
640636
switch (eval_mode) {
@@ -692,10 +688,11 @@ static int CeedOperatorBuildKernelBasis_Cuda_gen(std::ostringstream &code, CeedO
692688
// LCOV_EXCL_START
693689
case CEED_EVAL_WEIGHT:
694690
break; // Should not occur
691+
// LCOV_EXCL_STOP
695692
case CEED_EVAL_DIV:
696693
case CEED_EVAL_CURL:
694+
data->use_fallback = true;
697695
break; // TODO: Not implemented
698-
// LCOV_EXCL_STOP
699696
}
700697
}
701698
CeedCallBackend(CeedBasisDestroy(&basis));
@@ -762,11 +759,10 @@ static int CeedOperatorBuildKernelQFunction_Cuda_gen(std::ostringstream &code, C
762759
break;
763760
case CEED_EVAL_WEIGHT:
764761
break;
765-
// LCOV_EXCL_START
766762
case CEED_EVAL_DIV:
767763
case CEED_EVAL_CURL:
764+
data->use_fallback = true;
768765
break; // TODO: Not implemented
769-
// LCOV_EXCL_STOP
770766
}
771767
}
772768

@@ -815,11 +811,10 @@ static int CeedOperatorBuildKernelQFunction_Cuda_gen(std::ostringstream &code, C
815811
code << tab << "CeedScalar r_s" << var_suffix << "[1];\n";
816812
code << tab << "r_s" << var_suffix << "[0] = 1.0;\n";
817813
break;
818-
// LCOV_EXCL_START
819814
case CEED_EVAL_DIV:
820815
case CEED_EVAL_CURL:
816+
data->use_fallback = true;
821817
break; // TODO: Not implemented
822-
// LCOV_EXCL_STOP
823818
}
824819
}
825820
code << "\n";
@@ -845,10 +840,11 @@ static int CeedOperatorBuildKernelQFunction_Cuda_gen(std::ostringstream &code, C
845840
// LCOV_EXCL_START
846841
case CEED_EVAL_WEIGHT:
847842
break; // Should not occur
843+
// LCOV_EXCL_STOP
848844
case CEED_EVAL_DIV:
849845
case CEED_EVAL_CURL:
846+
data->use_fallback = true;
850847
break; // TODO: Not implemented
851-
// LCOV_EXCL_STOP
852848
}
853849
}
854850

@@ -926,11 +922,10 @@ static int CeedOperatorBuildKernelQFunction_Cuda_gen(std::ostringstream &code, C
926922
code << tab << "CeedScalar r_s" << var_suffix << "[1];\n";
927923
code << tab << "r_s" << var_suffix << "[0] = r_q" << var_suffix << "[q];\n";
928924
break;
929-
// LCOV_EXCL_START
930925
case CEED_EVAL_DIV:
931926
case CEED_EVAL_CURL:
927+
data->use_fallback = true;
932928
break; // TODO: Not implemented
933-
// LCOV_EXCL_STOP
934929
}
935930
}
936931
code << "\n";
@@ -956,10 +951,11 @@ static int CeedOperatorBuildKernelQFunction_Cuda_gen(std::ostringstream &code, C
956951
// LCOV_EXCL_START
957952
case CEED_EVAL_WEIGHT:
958953
break; // Should not occur
954+
// LCOV_EXCL_STOP
959955
case CEED_EVAL_DIV:
960956
case CEED_EVAL_CURL:
957+
data->use_fallback = true;
961958
break; // TODO: Not implemented
962-
// LCOV_EXCL_STOP
963959
}
964960
}
965961
} else {
@@ -1072,10 +1068,11 @@ static int CeedOperatorBuildKernelQFunction_Cuda_gen(std::ostringstream &code, C
10721068
// LCOV_EXCL_START
10731069
case CEED_EVAL_WEIGHT:
10741070
break; // Should not occur
1071+
// LCOV_EXCL_STOP
10751072
case CEED_EVAL_DIV:
10761073
case CEED_EVAL_CURL:
1074+
data->use_fallback = true;
10771075
break; // TODO: Not implemented
1078-
// LCOV_EXCL_STOP
10791076
}
10801077
}
10811078
} else if (use_3d_slices) {
@@ -1114,10 +1111,11 @@ static int CeedOperatorBuildKernelQFunction_Cuda_gen(std::ostringstream &code, C
11141111
// LCOV_EXCL_START
11151112
case CEED_EVAL_WEIGHT:
11161113
break; // Should not occur
1114+
// LCOV_EXCL_STOP
11171115
case CEED_EVAL_DIV:
11181116
case CEED_EVAL_CURL:
1117+
data->use_fallback = true;
11191118
break; // TODO: Not implemented
1120-
// LCOV_EXCL_STOP
11211119
}
11221120
}
11231121
}
@@ -1222,6 +1220,13 @@ extern "C" int CeedOperatorBuildKernel_Cuda_gen(CeedOperator op, bool *is_good_b
12221220
CeedCallBackend(CeedOperatorBuildKernelData_Cuda_gen(ceed, num_input_fields, op_input_fields, qf_input_fields, num_output_fields,
12231221
op_output_fields, qf_output_fields, &max_P, &max_P_1d, &Q, &Q_1d, &max_dim, &is_all_tensor,
12241222
&use_3d_slices));
1223+
if (data->use_fallback) {
1224+
*is_good_build = false;
1225+
CeedCallBackend(CeedOperatorSetSetupDone(op));
1226+
CeedCallBackend(CeedDestroy(&ceed));
1227+
CeedCallBackend(CeedQFunctionDestroy(&qf));
1228+
return CEED_ERROR_SUCCESS;
1229+
}
12251230
data->max_P_1d = is_all_tensor ? max_P_1d : max_P;
12261231
}
12271232
if (is_at_points) {

0 commit comments

Comments
 (0)