@@ -600,6 +600,7 @@ static int CeedOperatorSetupAtPoints_Cuda(CeedOperator op) {
600600 CeedCallBackend (CeedElemRestrictionGetNumPointsInElement (rstr_points , e , & num_points_elem ));
601601 impl -> num_points [e ] = num_points_elem ;
602602 }
603+ CeedCallBackend (CeedElemRestrictionDestroy (& rstr_points ));
603604 }
604605 impl -> max_num_points = max_num_points ;
605606
@@ -779,6 +780,8 @@ static int CeedOperatorApplyAddAtPoints_Cuda(CeedOperator op, CeedVector in_vec,
779780 CeedCallBackend (CeedOperatorAtPointsGetPoints (op , & rstr_points , & point_coords ));
780781 CeedCallBackend (CeedElemRestrictionCreateVector (rstr_points , NULL , & impl -> point_coords_elem ));
781782 CeedCallBackend (CeedElemRestrictionApply (rstr_points , CEED_NOTRANSPOSE , point_coords , impl -> point_coords_elem , request ));
783+ CeedCallBackend (CeedVectorDestroy (& point_coords ));
784+ CeedCallBackend (CeedElemRestrictionDestroy (& rstr_points ));
782785 }
783786
784787 // Process inputs
@@ -1538,11 +1541,9 @@ static int CeedSingleOperatorAssembleSetup_Cuda(CeedOperator op, CeedInt use_cee
15381541 CeedCallCuda (ceed , cudaMemcpy (& asmb -> d_B_in [i * elem_size_in * num_qpts_in ], h_B_in , elem_size_in * num_qpts_in * sizeof (CeedScalar ),
15391542 cudaMemcpyHostToDevice ));
15401543 }
1541-
1542- if (identity ) {
1543- CeedCallBackend (CeedFree (& identity ));
1544- }
1544+ CeedCallBackend (CeedFree (& identity ));
15451545 }
1546+ CeedCallBackend (CeedFree (& eval_modes_in ));
15461547
15471548 // Load into B_out, in order that they will be used in eval_modes_out
15481549 {
@@ -1575,11 +1576,9 @@ static int CeedSingleOperatorAssembleSetup_Cuda(CeedOperator op, CeedInt use_cee
15751576 CeedCallCuda (ceed , cudaMemcpy (& asmb -> d_B_out [i * elem_size_out * num_qpts_out ], h_B_out , elem_size_out * num_qpts_out * sizeof (CeedScalar ),
15761577 cudaMemcpyHostToDevice ));
15771578 }
1578-
1579- if (identity ) {
1580- CeedCallBackend (CeedFree (& identity ));
1581- }
1579+ CeedCallBackend (CeedFree (& identity ));
15821580 }
1581+ CeedCallBackend (CeedFree (& eval_modes_out ));
15831582 return CEED_ERROR_SUCCESS ;
15841583}
15851584
@@ -1743,6 +1742,8 @@ static int CeedOperatorLinearAssembleAddDiagonalAtPoints_Cuda(CeedOperator op, C
17431742 CeedCallBackend (CeedOperatorAtPointsGetPoints (op , & rstr_points , & point_coords ));
17441743 CeedCallBackend (CeedElemRestrictionCreateVector (rstr_points , NULL , & impl -> point_coords_elem ));
17451744 CeedCallBackend (CeedElemRestrictionApply (rstr_points , CEED_NOTRANSPOSE , point_coords , impl -> point_coords_elem , request ));
1745+ CeedCallBackend (CeedVectorDestroy (& point_coords ));
1746+ CeedCallBackend (CeedElemRestrictionDestroy (& rstr_points ));
17461747 }
17471748
17481749 // Process inputs
@@ -1933,6 +1934,10 @@ static int CeedOperatorLinearAssembleAddDiagonalAtPoints_Cuda(CeedOperator op, C
19331934 for (CeedInt i = 0 ; i < num_input_fields ; i ++ ) {
19341935 CeedCallBackend (CeedOperatorInputRestore_Cuda (op_input_fields [i ], qf_input_fields [i ], i , NULL , NULL , true, impl ));
19351936 }
1937+
1938+ // Restore work vector
1939+ CeedCallBackend (CeedRestoreWorkVector (ceed , & active_e_vec_in ));
1940+ CeedCallBackend (CeedRestoreWorkVector (ceed , & active_e_vec_out ));
19361941 return CEED_ERROR_SUCCESS ;
19371942}
19381943
0 commit comments