Skip to content

Commit 730973c

Browse files
authored
Add clang-format configuration and formatting checks (#77)
* add .clang-format * apply format * add format checker and spelling workflow * update action name
1 parent 1683edf commit 730973c

20 files changed

Lines changed: 2257 additions & 1946 deletions

.clang-format

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
BasedOnStyle: LLVM
2+
3+
IndentWidth: 4
4+
TabWidth: 4
5+
UseTab: Never
6+
7+
ColumnLimit: 120
8+
9+
BreakBeforeBraces: Allman
10+
11+
PointerAlignment: Right
12+
DerivePointerAlignment: false
13+
14+
BinPackParameters: false
15+
BinPackArguments: false
16+
17+
AllowShortIfStatementsOnASingleLine: false
18+
AllowShortLoopsOnASingleLine: false
19+
AllowShortFunctionsOnASingleLine: false
20+
21+
IndentCaseLabels: true
22+
InsertNewlineAtEOF: true
23+
24+
SortIncludes: true
25+
26+
ReflowComments: false
27+
AlignOperands: false
28+
29+
StatementMacros:
30+
- ASSERT
31+
- CHECK
32+
- REQUIRE
33+
- ENSURE
34+
- EXPECT
35+
- CUDA_CHECK
36+
- CUBLAS_CHECK
37+
- CUSPARSE_CHECK
38+
39+
AttributeMacros:
40+
- __global__
41+
- __device__
42+
- __host__
43+
- __shared__
44+
- __constant__
45+
- __managed__
46+
- __launch_bounds__
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Format
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
name: Clang Format Check
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: DoozyX/clang-format-lint-action@v0.20
18+
with:
19+
source: '.'
20+
extensions: 'h,c,cu'
21+
clangFormatVersion: 20

.github/workflows/spelling.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Spelling
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
workflow_dispatch:
12+
13+
env:
14+
CLICOLOR: 1
15+
16+
jobs:
17+
spelling:
18+
name: Spell Check with Typos
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout Actions Repository
22+
uses: actions/checkout@v5
23+
- name: Spell Check Repo
24+
uses: crate-ci/typos@v1.42.3

include/cupdlpx.h

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,19 @@ extern "C"
2424
#endif
2525

2626
// create an lp_problem_t from a matrix descriptor
27-
lp_problem_t *create_lp_problem(
28-
const double *objective_c,
29-
const matrix_desc_t *A_desc,
30-
const double *con_lb,
31-
const double *con_ub,
32-
const double *var_lb,
33-
const double *var_ub,
34-
const double *objective_constant);
27+
lp_problem_t *create_lp_problem(const double *objective_c,
28+
const matrix_desc_t *A_desc,
29+
const double *con_lb,
30+
const double *con_ub,
31+
const double *var_lb,
32+
const double *var_ub,
33+
const double *objective_constant);
3534

3635
// Set up initial primal and dual solution for an lp_problem_t
3736
void set_start_values(lp_problem_t *prob, const double *primal, const double *dual);
3837

3938
// solve the LP problem using PDHG
40-
cupdlpx_result_t *solve_lp_problem(
41-
lp_problem_t *prob,
42-
const pdhg_parameters_t *params);
39+
cupdlpx_result_t *solve_lp_problem(lp_problem_t *prob, const pdhg_parameters_t *params);
4340

4441
// parameter
4542
void set_default_parameters(pdhg_parameters_t *params);
@@ -50,4 +47,4 @@ extern "C"
5047

5148
#ifdef __cplusplus
5249
} // extern "C"
53-
#endif
50+
#endif

0 commit comments

Comments
 (0)