-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor libCEED QFunction source code to accelerate JIT compilation
- Loading branch information
1 parent
e7c0456
commit 4a464e8
Showing
122 changed files
with
3,478 additions
and
2,738 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef PALACE_LIBCEED_H1_1_QF_H | ||
#define PALACE_LIBCEED_H1_1_QF_H | ||
|
||
#include "../coeff/coeff_1_qf.h" | ||
|
||
CEED_QFUNCTION(f_apply_h1_1)(void *__restrict__ ctx, CeedInt Q, const CeedScalar *const *in, | ||
CeedScalar *const *out) | ||
{ | ||
const CeedScalar *attr = in[0], *wdetJ = in[0] + Q, *u = in[1]; | ||
CeedScalar *v = out[0]; | ||
|
||
CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) | ||
{ | ||
const CeedScalar coeff = CoeffUnpack1((const CeedIntScalar *)ctx, (CeedInt)attr[i]); | ||
|
||
v[i] = coeff * wdetJ[i] * u[i]; | ||
} | ||
return 0; | ||
} | ||
|
||
#endif // PALACE_LIBCEED_H1_1_QF_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef PALACE_LIBCEED_H1_BUILD_1_QF_H | ||
#define PALACE_LIBCEED_H1_BUILD_1_QF_H | ||
|
||
#include "../coeff/coeff_1_qf.h" | ||
|
||
CEED_QFUNCTION(f_build_h1_1)(void *__restrict__ ctx, CeedInt Q, const CeedScalar *const *in, | ||
CeedScalar *const *out) | ||
{ | ||
const CeedScalar *attr = in[0], *wdetJ = in[0] + Q; | ||
CeedScalar *qd = out[0]; | ||
|
||
CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) | ||
{ | ||
const CeedScalar coeff = CoeffUnpack1((const CeedIntScalar *)ctx, (CeedInt)attr[i]); | ||
|
||
qd[i] = coeff * wdetJ[i]; | ||
} | ||
return 0; | ||
} | ||
|
||
#endif // PALACE_LIBCEED_H1_BUILD_1_QF_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef PALACE_LIBCEED_L2_1_QF_H | ||
#define PALACE_LIBCEED_L2_1_QF_H | ||
|
||
#include "../coeff/coeff_1_qf.h" | ||
|
||
CEED_QFUNCTION(f_apply_l2_1)(void *__restrict__ ctx, CeedInt Q, const CeedScalar *const *in, | ||
CeedScalar *const *out) | ||
{ | ||
const CeedScalar *attr = in[0], *wdetJ = in[0] + Q, *qw = in[1], *u = in[2]; | ||
CeedScalar *v = out[0]; | ||
|
||
CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) | ||
{ | ||
const CeedScalar coeff = CoeffUnpack1((const CeedIntScalar *)ctx, (CeedInt)attr[i]); | ||
|
||
v[i] = (coeff * qw[i] * qw[i] / wdetJ[i]) * u[i]; | ||
} | ||
return 0; | ||
} | ||
|
||
#endif // PALACE_LIBCEED_L2_1_QF_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef PALACE_LIBCEED_L2_BUILD_1_QF_H | ||
#define PALACE_LIBCEED_L2_BUILD_1_QF_H | ||
|
||
#include "../coeff/coeff_1_qf.h" | ||
|
||
CEED_QFUNCTION(f_build_l2_1)(void *__restrict__ ctx, CeedInt Q, const CeedScalar *const *in, | ||
CeedScalar *const *out) | ||
{ | ||
const CeedScalar *attr = in[0], *wdetJ = in[0] + Q, *qw = in[1]; | ||
CeedScalar *qd = out[0]; | ||
|
||
CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) | ||
{ | ||
const CeedScalar coeff = CoeffUnpack1((const CeedIntScalar *)ctx, (CeedInt)attr[i]); | ||
|
||
qd[i] = coeff * qw[i] * qw[i] / wdetJ[i]; | ||
} | ||
return 0; | ||
} | ||
|
||
#endif // PALACE_LIBCEED_L2_BUILD_1_QF_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef PALACE_LIBCEED_H1_2_QF_H | ||
#define PALACE_LIBCEED_H1_2_QF_H | ||
|
||
#include "../coeff/coeff_2_qf.h" | ||
|
||
CEED_QFUNCTION(f_apply_h1_2)(void *__restrict__ ctx, CeedInt Q, const CeedScalar *const *in, | ||
CeedScalar *const *out) | ||
{ | ||
const CeedScalar *attr = in[0], *wdetJ = in[0] + Q, *u = in[1]; | ||
CeedScalar *v = out[0]; | ||
|
||
CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) | ||
{ | ||
CeedScalar coeff[3]; | ||
CoeffUnpack2((const CeedIntScalar *)ctx, (CeedInt)attr[i], coeff); | ||
|
||
const CeedScalar u0 = u[i + Q * 0]; | ||
const CeedScalar u1 = u[i + Q * 1]; | ||
v[i + Q * 0] = wdetJ[i] * (coeff[0] * u0 + coeff[1] * u1); | ||
v[i + Q * 1] = wdetJ[i] * (coeff[1] * u0 + coeff[2] * u1); | ||
} | ||
return 0; | ||
} | ||
|
||
#endif // PALACE_LIBCEED_H1_2_QF_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef PALACE_LIBCEED_H1_BUILD_2_QF_H | ||
#define PALACE_LIBCEED_H1_BUILD_2_QF_H | ||
|
||
#include "../coeff/coeff_2_qf.h" | ||
|
||
CEED_QFUNCTION(f_build_h1_2)(void *__restrict__ ctx, CeedInt Q, const CeedScalar *const *in, | ||
CeedScalar *const *out) | ||
{ | ||
const CeedScalar *attr = in[0], *wdetJ = in[0] + Q; | ||
CeedScalar *qd = out[0]; | ||
|
||
CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) | ||
{ | ||
CeedScalar coeff[3]; | ||
CoeffUnpack2((const CeedIntScalar *)ctx, (CeedInt)attr[i], coeff); | ||
|
||
qd[i + Q * 0] = wdetJ[i] * coeff[0]; | ||
qd[i + Q * 1] = wdetJ[i] * coeff[1]; | ||
qd[i + Q * 2] = wdetJ[i] * coeff[2]; | ||
} | ||
return 0; | ||
} | ||
|
||
#endif // PALACE_LIBCEED_H1_BUILD_2_QF_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef PALACE_LIBCEED_L2_2_QF_H | ||
#define PALACE_LIBCEED_L2_2_QF_H | ||
|
||
#include "../coeff/coeff_2_qf.h" | ||
|
||
CEED_QFUNCTION(f_apply_l2_2)(void *__restrict__ ctx, CeedInt Q, const CeedScalar *const *in, | ||
CeedScalar *const *out) | ||
{ | ||
const CeedScalar *attr = in[0], *wdetJ = in[0] + Q, *qw = in[1], *u = in[2]; | ||
CeedScalar *v = out[0]; | ||
|
||
CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) | ||
{ | ||
CeedScalar coeff[3]; | ||
CoeffUnpack2((const CeedIntScalar *)ctx, (CeedInt)attr[i], coeff); | ||
const CeedScalar w = qw[i] * qw[i] / wdetJ[i]; | ||
|
||
const CeedScalar u0 = u[i + Q * 0]; | ||
const CeedScalar u1 = u[i + Q * 1]; | ||
v[i + Q * 0] = w * (coeff[0] * u0 + coeff[1] * u1); | ||
v[i + Q * 1] = w * (coeff[1] * u0 + coeff[2] * u1); | ||
} | ||
return 0; | ||
} | ||
|
||
#endif // PALACE_LIBCEED_L2_2_QF_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef PALACE_LIBCEED_L2_BUILD_2_QF_H | ||
#define PALACE_LIBCEED_L2_BUILD_2_QF_H | ||
|
||
#include "../coeff/coeff_2_qf.h" | ||
|
||
CEED_QFUNCTION(f_build_l2_2)(void *__restrict__ ctx, CeedInt Q, const CeedScalar *const *in, | ||
CeedScalar *const *out) | ||
{ | ||
const CeedScalar *attr = in[0], *wdetJ = in[0] + Q, *qw = in[1]; | ||
CeedScalar *qd = out[0]; | ||
|
||
CeedPragmaSIMD for (CeedInt i = 0; i < Q; i++) | ||
{ | ||
CeedScalar coeff[3]; | ||
CoeffUnpack2((const CeedIntScalar *)ctx, (CeedInt)attr[i], coeff); | ||
const CeedScalar w = qw[i] * qw[i] / wdetJ[i]; | ||
|
||
qd[i + Q * 0] = w * coeff[0]; | ||
qd[i + Q * 1] = w * coeff[1]; | ||
qd[i + Q * 2] = w * coeff[2]; | ||
} | ||
return 0; | ||
} | ||
|
||
#endif // PALACE_LIBCEED_L2_BUILD_2_QF_H |
Oops, something went wrong.