reduce err across threads, modify xsdata scripts

This commit is contained in:
Shikhar Kumar 2019-07-10 13:00:29 -04:00
parent 0da3bf3381
commit 3974631b72
3 changed files with 7 additions and 7 deletions

View file

@ -158,7 +158,7 @@ with tempfile.TemporaryDirectory() as tmpdir:
print('Creating compressed archive...')
test_tar = pwd / 'nndc_hdf5_test.tar.xz'
with tarfile.open(str(test_tar), 'w:xz') as txz:
txz.add('nndc_hdf5')
txz.add(output_dir)
# Change back to original directory
os.chdir(str(pwd))

View file

@ -101,7 +101,7 @@ int cmfd_linsolver_1g(const double* A_data, const double* b, double* x,
for (int irb = 0; irb < 2; irb++) {
// Loop around matrix rows
#pragma omp parallel for
#pragma omp parallel for reduction (+:err)
for (int irow = 0; irow < cmfd::dim; irow++) {
int g, i, j, k;
matrix_to_indices(irow, g, i, j, k);
@ -127,12 +127,13 @@ int cmfd_linsolver_1g(const double* A_data, const double* b, double* x,
// Compute residual and update error
double res = (tmpx[irow] - x[irow]) / tmpx[irow];
err += res * res;
err = res * res;
}
}
// Check convergence
err = std::sqrt(err / cmfd::dim);
std::cout << err << "\n";
if (err < tol)
return igs;
@ -168,7 +169,7 @@ int cmfd_linsolver_2g(const double* A_data, const double* b, double* x,
for (int irb = 0; irb < 2; irb++) {
// Loop around matrix rows
#pragma omp parallel for
#pragma omp parallel for reduction (+:err)
for (int irow = 0; irow < cmfd::dim; irow+=2) {
int g, i, j, k;
matrix_to_indices(irow, g, i, j, k);
@ -219,7 +220,7 @@ int cmfd_linsolver_2g(const double* A_data, const double* b, double* x,
// Compute residual and update error
double res = (tmpx[irow] - x[irow]) / tmpx[irow];
err += res * res;
err = res * res;
}
}
@ -257,7 +258,6 @@ int cmfd_linsolver_ng(const double* A_data, const double* b, double* x,
std::vector<double> tmpx {x, x+cmfd::dim};
// Loop around matrix rows
#pragma omp parallel for
for (int irow = 0; irow < cmfd::dim; irow++) {
// Get index of diagonal for current row
int didx = get_diagonal_index(irow);

View file

@ -7,7 +7,7 @@ if [[ ! -e $HOME/nndc_hdf5/cross_sections.xml ]]; then
fi
# Download ENDF/B-VII.1 distribution
ENDF=$HOME/endf-b-vii.1/
ENDF=$HOME/endf-b-vii.1
if [[ ! -d $ENDF/neutrons || ! -d $ENDF/photoat || ! -d $ENDF/atomic_relax ]]; then
wget -q -O - https://anl.box.com/shared/static/4kd2gxnf4gtk4w1c8eua5fsua22kvgjb.xz | tar -C $HOME -xJ
fi