Skip to content
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
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ check_PROGRAMS = neogb_io \
checkdiff = test/diff/diff_bug-2nd-prime-bad.sh \
test/diff/diff_bug-68.sh \
test/diff/diff_bug-empty-tracer.sh \
test/diff/diff_bug-prob-sparse-dense-la.sh \
test/diff/diff_cp-d3-n4-p2.sh \
test/diff/diff_cyclic5-16.sh \
test/diff/diff_cyclic5-31.sh \
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ AC_CONFIG_LINKS([
input_files/bug-empty-tracer.ms:input_files/bug-empty-tracer.ms
output_files/bug-empty-tracer.g2.res:output_files/bug-empty-tracer.g2.res
test/diff/diff_bug-empty-tracer.sh:test/diff/diff_bug-empty-tracer.sh
test/diff/diff_bug-prob-sparse-dense-la.sh:test/diff/diff_bug-prob-sparse-dense-la.sh
input_files/choice-linear-form-qq.ms:input_files/choice-linear-form-qq.ms
output_files/choice-linear-form-qq.P2.d0.res:output_files/choice-linear-form-qq.P2.d0.res
output_files/choice-linear-form-qq.p128.res:output_files/choice-linear-form-qq.p128.res
Expand Down
8 changes: 4 additions & 4 deletions src/neogb/la_ff_16.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ static void probabilistic_sparse_reduced_echelon_form_ff_16(
/* fill random value array */
for (j = 0; j < nrbl; ++j) {
do {
mull[j] = (int64_t)rand() & fc;
mull[j] = (int64_t)rand() % fc;
} while (mull[j] == 0);
}
/* generate one dense row as random linear combination
Expand Down Expand Up @@ -1660,7 +1660,7 @@ static cf16_t **probabilistic_dense_linear_algebra_ff_16(
#pragma omp parallel for num_threads(st->nthrds) \
private(i, j, k, l) shared(nps, tbr) \
schedule(dynamic)
for (i = 0; i < ntr; ++i) {
for (i = 0; i < nb; ++i) {
int64_t *drl = dr + (omp_get_thread_num() * (uint64_t)ncr);
int64_t *mull = mul + (omp_get_thread_num() * (uint64_t)rpb);
const int32_t nbl = (int32_t) (ntr > (i+1)*rpb ? (i+1)*rpb : ntr);
Expand All @@ -1678,7 +1678,7 @@ static cf16_t **probabilistic_dense_linear_algebra_ff_16(
/* fill random value array */
for (j = 0; j < nrbl; ++j) {
do {
mull[j] = (int64_t)rand() & fc;
mull[j] = (int64_t)rand() % fc;
} while (mull[j] == 0);
}
/* generate one dense row as random linear combination
Expand Down Expand Up @@ -1812,7 +1812,7 @@ static cf16_t **probabilistic_sparse_dense_echelon_form_ff_16(
/* fill random value array */
for (j = 0; j < nrbl; ++j) {
do {
mull[j] = (int64_t)rand() & fc;
mull[j] = (int64_t)rand() % fc;
} while (mull[j] == 0);
}
/* generate one dense row as random linear combination
Expand Down
8 changes: 4 additions & 4 deletions src/neogb/la_ff_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static int is_kernel_trivial(
/* fill random value array */
for (i = 0; i < ncr; ++i) {
do {
mull[j] = (int64_t)rand() & fc;
mull[j] = (int64_t)rand() % fc;
} while (mull[j] == 0);
}
for (i = 0; i < sat->ld; ++i) {
Expand Down Expand Up @@ -3586,7 +3586,7 @@ static cf32_t **probabilistic_dense_linear_algebra_ff_32(
#pragma omp parallel for num_threads(st->nthrds) \
private(i, j, k, l) shared(nps, tbr) \
schedule(dynamic)
for (i = 0; i < ntr; ++i) {
for (i = 0; i < nb; ++i) {
int64_t *drl = dr + (omp_get_thread_num() * (uint64_t)ncr);
int64_t *mull = mul + (omp_get_thread_num() * (uint64_t)rpb);
const int32_t nbl = (int32_t) (ntr > (i+1)*rpb ? (i+1)*rpb : ntr);
Expand Down Expand Up @@ -3716,7 +3716,7 @@ static cf32_t **probabilistic_sparse_dense_echelon_form_ff_32(
int64_t *dr = (int64_t *)malloc(
(uint64_t)ncols * st->nthrds * sizeof(int64_t));
int64_t *mul = (int64_t *)malloc(
(uint64_t)ncols * st->nthrds * sizeof(int64_t));
(uint64_t)rpb * st->nthrds * sizeof(int64_t));

/* reduction process to get all possible pivots, no interreduction here */
#pragma omp parallel for num_threads(st->nthrds) \
Expand All @@ -3738,7 +3738,7 @@ static cf32_t **probabilistic_sparse_dense_echelon_form_ff_32(
/* fill random value array */
for (j = 0; j < nrbl; ++j) {
do {
mull[j] = (int64_t)rand() & fc;
mull[j] = (int64_t)rand() % fc;
} while (mull[j] == 0);
}
/* generate one dense row as random linear combination
Expand Down
8 changes: 4 additions & 4 deletions src/neogb/la_ff_8.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ static void probabilistic_sparse_reduced_echelon_form_ff_8(
/* fill random value array */
for (j = 0; j < nrbl; ++j) {
do {
mull[j] = (int64_t)rand() & fc;
mull[j] = (int64_t)rand() % fc;
} while (mull[j] == 0);
}
/* generate one dense row as random linear combination
Expand Down Expand Up @@ -1789,7 +1789,7 @@ static cf8_t **probabilistic_dense_linear_algebra_ff_8(
#pragma omp parallel for num_threads(st->nthrds) \
private(i, j, k, l) shared(nps, tbr) \
schedule(dynamic)
for (i = 0; i < ntr; ++i) {
for (i = 0; i < nb; ++i) {
int64_t *drl = dr + (omp_get_thread_num() * (uint64_t)ncr);
int64_t *mull = mul + (omp_get_thread_num() * (uint64_t)rpb);
const int32_t nbl = (int32_t) (ntr > (i+1)*rpb ? (i+1)*rpb : ntr);
Expand All @@ -1807,7 +1807,7 @@ static cf8_t **probabilistic_dense_linear_algebra_ff_8(
/* fill random value array */
for (j = 0; j < nrbl; ++j) {
do {
mull[j] = (int64_t)rand() & fc;
mull[j] = (int64_t)rand() % fc;
} while (mull[j] == 0);
}
/* generate one dense row as random linear combination
Expand Down Expand Up @@ -1941,7 +1941,7 @@ static cf8_t **probabilistic_sparse_dense_echelon_form_ff_8(
/* fill random value array */
for (j = 0; j < nrbl; ++j) {
do {
mull[j] = (int64_t)rand() & fc;
mull[j] = (int64_t)rand() % fc;
} while (mull[j] == 0);
}
/* generate one dense row as random linear combination
Expand Down
36 changes: 36 additions & 0 deletions test/diff/diff_bug-prob-sparse-dense-la.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

# Probabilistic sparse/dense linear algebra (-l 42) used to lose rows on
# small matrices since the random multipliers were not uniformly chosen
# in [1, p-1]. Then msolve wrote an empty output file while exiting with
# status 0. The failure depends on the random seed, thus we run several
# consecutive seeds. Line 5 of the output (the random linear form) depends
# on the seed and is not compared.

file=nonradical-radicalshape-31

source test/diff/diff_source.sh

sed 5d output_files/$file.res > test/diff/$file.prob-la.ref

for i in $(seq 0 39); do
for t in 1 2; do
$(pwd)/msolve -f input_files/$file.ms -o test/diff/$file.prob-la.res \
--random-seed $((seed + i)) -P 1 -l 42 -t $t
if [ $? -gt 0 ]; then
print_exit 1
fi

sed 5d test/diff/$file.prob-la.res | \
diff - test/diff/$file.prob-la.ref
if [ $? -gt 0 ]; then
print_exit 2
fi

rm test/diff/$file.prob-la.res
done
done

rm test/diff/$file.prob-la.ref

normal_exit
Loading