Commit 937c04ae authored by Christopher Subich's avatar Christopher Subich
Browse files

Update dependencies to Blitz 1.0.2 and update to new MPI standard

This commit updates to build newer versions of Blitz (1.0)
and fftw (3.3.9).  The 2010 version of Blitz no longer builds with the
newest versions of GCC, and there is no harm in updating FFTW.

The newest versions of Blitz (github head) require cmake to
build, and some systems still in use have old, incompatible versions of
cmake.  Blitz 1.0.2 requires python to complete its build process (some
files are auto-generated).

The new version of Blitz dropped the blitz::Vector type, being
equivalent to a 1-dimensional array, so it was replaced with
blitz::Array<type,1> instead.

Additionally, the Parformer (parallel transpose) code was adjusted to no
longer use MPI_UB to define the upper bound of the array section
datatype.  MPI_UB was deprecated in the MPI-2 standard and removed in
the MPI-3 standard, so SPINS could fail to build with some new MPI
libraries (OpenMPI 4.0.3 is confirmed to break).

Because this commit updates depende...
parent 782fb3e0
......@@ -70,11 +70,11 @@ if [ ! "$BUILD_BLITZ" = "yes" ]; then
echo "Building Blitz++"
# Download the Blitz tarball if necessary
if [ ! -e "blitz_2010.tgz" ]; then
mv redist_libs/blitz_2010.tgz ./
if [ ! -e "blitz_1.0.2.tar.gz" ]; then
mv redist_libs/blitz_1.0.2.tar.gz ./
(tar -xzvf blitz_2010.tgz > /dev/null) || (echo "Untar of Blitz FAILED"; exit 1);
pushd blitz
(tar -xzvf blitz_1.0.2.tar.gz > /dev/null) || (echo "Untar of Blitz FAILED"; exit 1);
pushd blitz-1.0.2
(./configure --prefix="$CWD" --disable-fortran "${BLITZ_OPTIONS}" > /dev/null) && \
(make lib > /dev/null) && \
pushd blitz && (make install > /dev/null) && popd && \
......@@ -92,14 +92,14 @@ if [ ! "$BUILD_FFTW" = "yes" ]; then
echo "Building FFTW"
# Download FFTW if necessary
if [ ! -e "fftw-3.3.3.tar.gz" ]; then
mv redist_libs/fftw-3.3.3.tar.gz ./
if [ ! -e "fftw-3.3.9.tar.gz" ]; then
mv redist_libs/fftw-3.3.9.tar.gz ./
(tar -xzvf fftw-3.3.3.tar.gz > /dev/null)
(tar -xzvf fftw-3.3.9.tar.gz > /dev/null)
if [ 0 -ne $? ]; then
echo "Untar of FFTW FAILED"; exit 1
pushd fftw-3.3.3
pushd fftw-3.3.9
# The "${FFTW_OPTIONS[@]}" syntax expands FFTW_OPTIONS as an array variable;
# this allows for multi-word arguments like 'CFLAGS="-O3 --fast-math"' to
# work properly as a single argument from configure's perspective.
#include "TArray.hpp"
#include "blitz/array.h"
#include "blitz/tinyvec-et.h"
#include "ESolver.hpp"
#include "gmres_1d_solver.hpp"
#include "gmres_2d_solver.hpp"
......@@ -2,7 +2,6 @@
#include "Parformer.hpp"
#include "Par_util.hpp"
#include <blitz/tinyvec-et.h>
#include <stdio.h>
#include <iostream>
......@@ -10,7 +10,6 @@
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <blitz/tinyvec-et.h>
#include "Sorter.hpp"
......@@ -2,7 +2,6 @@
#include <vector>
#include <blitz/array.h>
#include <blitz/tinyvec-et.h>
#include <stdio.h>
#include <iostream>
#include <complex>
......@@ -121,7 +120,7 @@ src_temp(0), dst_temp(0), issue_warning(true) {
rec_types.resize(num_proc); // make sure our vector can hold everything
for (int i = 0; i < num_proc; i++) {
// We'll have to use the MPI_Type_struct syntax, so build arrays:
/*// We'll have to use the MPI_Type_struct syntax, so build arrays:
MPI_Datatype types[2] = {vec_type,MPI_UB};
int counts[2]; counts[0] = extent_from[i]; counts[1] = 1;
// Now, set displacements to set the "end" of the datatype a full
......@@ -129,8 +128,23 @@ src_temp(0), dst_temp(0), issue_warning(true) {
MPI_Aint displs[2] = {0,sizeof(T)*sizes[untouched_dim]*sizes[from_dim]};
// And make the type
// This code formerly used the MPI_UB marker to define the upper bound
// of the derived datatype. This was deprecated as part of the MPI-2
// standard, and it was removed in MPI-3. The replacement is to use
// MPI_Type_create_resized to create a resized type directly.
// First, create the multi-vector containing the data:
MPI_Datatype multivec;
MPI_Type_create_resized(multivec, 0, // base type, lower bound
sizeof(T)*sizes[untouched_dim]*sizes[from_dim], // extent
&rec_types[i]); // new type
/* Impelementation note: one optimization possible here is to collapse
this typelist. This impelementation makes no assumptions about how
many part-rows are received per processor, but our default splitting
#include "TArray.hpp"
#include "Plan_holder.hpp"
#include <blitz/tinyvec-et.h>
#include <assert.h>
#include <fftw3.h> // FFTW
/* Implementation of TArray transform functions for the relevant cases.
#include "T_util.hpp"
#include "TArray.hpp"
#include <blitz/array.h>
#include <blitz/tinyvec-et.h>
#include "Par_util.hpp"
#include <complex>
#include <string>
......@@ -269,8 +269,8 @@ template <class Controller> class GMRES_Solver {
/* Perform the inner iteration */
/* First, allocate vectors for residuals and the Krylov basis */
blitz::Vector<RType> resid_vec(num_its+1);
blitz::Vector<BType> basis_vec(num_its); // Note, these are base 0
blitz::Array<RType,1> resid_vec(num_its+1);
blitz::Array<BType,1> basis_vec(num_its); // Note, these are base 0
for (int k = 0; k < num_its; k++) {
resid_vec(k) = ops->alloc_resid();
basis_vec(k) = ops->alloc_basis();
......@@ -406,7 +406,7 @@ template <class Controller> class GMRES_Solver {
return my_it-1;
void build_x(BType out_x, blitz::Vector<BType> & basis_vec,
void build_x(BType out_x, blitz::Array<BType,1> & basis_vec,
blitz::Array<double,1> & rhs_vec, double starting_norm,
int my_it) {
/* Now, the Krylov basis is in basis_vec, and the proper multiples are in
......@@ -3,7 +3,6 @@
#include <blitz/array.h>
#include <iostream>
#include <blitz/tinyvec-et.h>
#include "umfpack.h"
#include "timing.hpp"
......@@ -1897,14 +1896,14 @@ void MG_Solver::_cycle(CYCLE_TYPE cycle, Array<double,2> & f, Array<double,2> &
that the problem is really of size (1+size_x*size_z);
this doesn't actually fit in u or f. So, allocate
static blitz-vectors for the data, if necessary. */
static blitz::Vector<double> extra_u(0), extra_f(0);
static blitz::Array<double,1> extra_u(0), extra_f(0);
// fprintf(stderr,"CG: Input residual\n");
// cerr << f;
if (indefinite_problem) {
// fprintf(stderr,"Solving indefinite problem on coarse grid\n");
if (extra_u.length() != (size_x*size_z+1))
if (extra_u.length(firstDim) != (size_x*size_z+1))
if (extra_f.length() != (size_x*size_z+1))
if (extra_f.length(firstDim) != (size_x*size_z+1))
// Copy the f-problem to extra_f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment