Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for d3q27_PSM #438

Merged
merged 5 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/cpu_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@ jobs:
strategy:
fail-fast: false
matrix:
model: [d2q9_npe_guo, d2q9_bc, d2q9, d2q9_SRT, d2q9_thin_film, d3q19, d3q19_les, d3q19_heat, d2q9_kuper, d2q9_pf, d2q9_pf_fd, d3q27, d3q27_cumulant, d3q27_cumulant_AVG_IB_SMAG]
model:
- d2q9_npe_guo
- d2q9_bc
- d2q9
- d2q9_SRT
- d2q9_thin_film
- d3q19
- d3q19_les
- d3q19_heat
- d2q9_kuper
- d2q9_pf
- d2q9_pf_fd
- d3q27
- d3q27_cumulant
- d3q27_cumulant_AVG_IB_SMAG
- d3q27_PSM_NEBB
steps:
- name: Git checkout
uses: actions/checkout@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/gpu_comp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ jobs:
strategy:
fail-fast: false
matrix:
model: [ d2q9, d2q9_bc, d3q27_cumulant, d3q27_cumulant_AVG_IB_SMAG]
model:
- d2q9
- d2q9_bc
- d3q27_cumulant
- d3q27_cumulant_AVG_IB_SMAG
- d3q27_PSM_NEBB
steps:
- name: Git checkout
uses: actions/checkout@v3
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/hip_comp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ jobs:
strategy:
fail-fast: false
matrix:
model: [ d2q9, d2q9_bc, d3q27_cumulant, d3q27_cumulant_AVG_IB_SMAG ]
model:
- d2q9
- d2q9_bc
- d3q27_cumulant
- d3q27_cumulant_AVG_IB_SMAG
- d3q27_PSM_NEBB
steps:
- name: Git checkout
uses: actions/checkout@v3
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/storage_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@ jobs:
strategy:
fail-fast: false
matrix:
model: [d2q9]
precision: [float, double]
storage: ['same', 'half', 'half-shift', "float", "float-shift", 'double']
gpu: [true, false]
model:
- d2q9
precision:
- float
- double
storage:
- 'same'
- 'half'
- 'half-shift'
- "float"
- "float-shift"
- 'double'
gpu:
- true
- false
exclude:
- gpu: false
storage: 'half'
Expand Down
19 changes: 19 additions & 0 deletions src/simplepart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <math.h>
#include <vector>

const double twopi = 8*atan(1.0);

struct Particle {
double x[3];
double r;
Expand Down Expand Up @@ -70,6 +72,11 @@ int main(int argc, char *argv[]) {
periodicity[i] = 0.0;
}

double acc_vec[3];
double acc_freq;
for (int i = 0; i < 3; i++) acc_vec[i] = 0.0;
acc_freq = 0.0;

if (argc != 2) {
printf("Syntax: simplepart config.xml\n");
MPI_Abort(MPI_COMM_WORLD,1);
Expand All @@ -92,6 +99,14 @@ int main(int argc, char *argv[]) {
std::string attr_name = attr.name();
if (attr_name == "dt") {
dt = attr.as_double();
} else if (attr_name == "ax") {
acc_vec[0] = attr.as_double();
} else if (attr_name == "ay") {
acc_vec[1] = attr.as_double();
} else if (attr_name == "az") {
acc_vec[2] = attr.as_double();
} else if (attr_name == "afreq") {
acc_freq = attr.as_double();
} else {
ERROR("Unknown atribute '%s' in '%s'", attr.name(), main_node.name());
return -1;
Expand Down Expand Up @@ -196,6 +211,9 @@ int main(int argc, char *argv[]) {
}
fprintf(logging_f, "\n");
}
for (Particles::iterator p = particles.begin(); p != particles.end(); p++) {
for (int i=0; i<3; i++) p->v[i] = p->v[i] - acc_vec[i] / 2.0;
}
int iter = 0;
while (RFI.Active()) {
for (int phase = 0; phase < 3; phase++) {
Expand Down Expand Up @@ -305,6 +323,7 @@ int main(int argc, char *argv[]) {
if (p->m > 0.0) {
for (int i=0; i<3; i++) p->v[i] = p->v[i] + p->f[i] / p->m * dt;
}
for (int i=0; i<3; i++) p->v[i] = p->v[i] + acc_vec[i] * cos(twopi * dt * iter * acc_freq);
for (int i=0; i<3; i++) p->x[i] = p->x[i] + p->v[i] * dt;
}
iter++;
Expand Down
15 changes: 9 additions & 6 deletions tools/csvdiff
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ options <- list(
make_option(c("-a","--filea"), "store", default="", help="First input file", type="character"),
make_option(c("-b","--fileb"), "store", default="", help="Second input file", type="character"),
make_option(c("-x","--limit"), "store", default=1e-10, help="Limit on the difference of numeric values", type="numeric"),
make_option(c("-d","--discard"), "store", default="", help="List of columns to discard", type="character")
make_option(c("-d","--discard"), "store", default="", help="regexp for columns to discard (separate by '|')", type="character")
)

opt <- parse_args(OptionParser(usage="Usage: csvdiff -a file -b file [-x 1e-10]", options))
Expand All @@ -25,13 +25,11 @@ opt$discard = strsplit(opt$discard,",")[[1]]
if (! is.character(opt$discard)) stop("Discard list is not text")

tab1 = read(opt$filea)
sel = names(tab1) %in% opt$discard
sel = grepl(opt$discard, names(tab1))
if (any(sel)) tab1=tab1[,!sel]
tab2 = read(opt$fileb)
sel = names(tab2) %in% opt$discard
sel = grepl(opt$discard, names(tab2))
if (any(sel)) tab2=tab2[,!sel]
print(names(tab1))
print(names(tab2))

if ( ! identical(dim(tab1),dim(tab2)) ) { cat("dimensions not identical\n"); q(status=-1); }
if ( ! identical(names(tab1), names(tab2)) ) { cat("names (header) not identical\n"); q(status=-2); }
Expand All @@ -46,7 +44,12 @@ for (i in names(tab1)) {
} else {
ret = identical(a,b)
}
if (! ret) { cat("differ at",i,"\n"); q(status=-3); }
if (! ret) {
cat("Differ at",i,"\n");
cat(" max(abs(a-b)) :",max(abs(a-b)),"\n");
cat(" eps :",eps,"\n");
q(status=-3);
}
}


Expand Down
3 changes: 2 additions & 1 deletion tools/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function runline {
;;
run) try "running solver" "$@" ;;
fail) try "running solver" '!' "$@" ;;
csvdiff) try "checking $R (csvdiff)" $TCLB/tools/csvdiff -a "$R" -b "$G" -x 1e-10 -d Walltime ;;
csvdiff) try "checking $R (csvdiff)" $TCLB/tools/csvdiff -a "$R" -b "$G" -x "${2:-1e-10}" -d ${3:-Walltime} ;;
diff) try "checking $R" diff "$R" "$G" ;;
sha1) try "checking $R (sha1)" sha1sum -c "$G.sha1" ;;
pvtidiff) try "checking $R (pvtidiff)" $TCLB/CLB/$MODEL/compare "$R" "$G" "${2:-8}" ;; # ${2:-8} is { if $2 == "" then "8" else $2 }
Expand All @@ -191,6 +191,7 @@ function testModel {
RESULT="OK"
TCLB=".."
SOLVER="$TCLB/CLB/$MODEL/main"
MODELBIN="$TCLB/CLB/$MODEL"
TEST_DIR="../tests/$MODEL"
if test -f "tests/$MODEL/$t"
then
Expand Down