Skip to content

Commit

Permalink
Issue 68 (#69)
Browse files Browse the repository at this point in the history
* Ensure python3 is used to detect numpy for cmake build
* Fixes #68
  • Loading branch information
bennahugo authored Jan 27, 2022
1 parent 5ff0b27 commit 04a1c8b
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 118 deletions.
110 changes: 110 additions & 0 deletions .ci/py3.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
FROM kernsuite/base:7

RUN docker-apt-install libblitz0-dev python3-dev libblas-dev liblapack-dev libqdbm-dev wcslib-dev \
libfftw3-dev python3-numpy libcfitsio-dev libboost-all-dev libboost-system-dev cmake g++ wget gfortran \
libncurses5-dev bison libbison-dev flex libreadline6-dev python3-pip rsync

#####################################################################
## Get CASACORE ephem data
#####################################################################
RUN mkdir -p /usr/share/casacore/data/
WORKDIR /usr/share/casacore/data/
RUN rsync -avz rsync://casa-rsync.nrao.edu/casa-data .

#####################################################################
## BUILD CASACORE AND CASAREST FROM SOURCE
## -- Kern version is missing executables from casarest
#####################################################################
WORKDIR /src
RUN wget https://github.com/casacore/casacore/archive/v3.4.0.tar.gz && \
tar xvf v3.4.0.tar.gz && \
rm v3.4.0.tar.gz && \
mkdir casacore-3.4.0/build && \
cd /src/casacore-3.4.0/build && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_DEPRECATED=ON -DBUILD_PYTHON=OFF -DBUILD_PYTHON3=ON ../ && \
make -j 4 && \
make install && \
rm -r /src/casacore-3.4.0 && \
cd /src && \
wget https://github.com/casacore/casarest/archive/v1.8.0.tar.gz && \
tar xvf v1.8.0.tar.gz && \
rm v1.8.0.tar.gz && \
cd /src/casarest-1.8.0 && \
mkdir -p build && \
cd /src/casarest-1.8.0/build && \
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release ../ && \
make -j 4 && \
make install && \
rm -r /src/casarest-1.8.0 && \
ldconfig && \
cd /src && \
wget https://github.com/casacore/python-casacore/archive/v3.4.0.tar.gz && \
tar xvf v3.4.0.tar.gz && \
rm v3.4.0.tar.gz && \
cd /src/python-casacore-3.4.0 && \
python3.8 -m pip install . && \
cd / && \
python3.8 -c "from pyrap.tables import table as tbl"


#####################################################################
## BUILD MAKEMS FROM SOURCE AND TEST
#####################################################################
WORKDIR /src
RUN wget https://github.com/ska-sa/makems/archive/v1.5.4.tar.gz && \
tar xvf v1.5.4.tar.gz && \
rm v1.5.4.tar.gz && \
mkdir -p /src/makems-1.5.4/LOFAR/build/gnu_opt && \
cd /src/makems-1.5.4/LOFAR/build/gnu_opt && \
cmake -DCMAKE_MODULE_PATH:PATH=/src/makems-1.5.4/LOFAR/CMake \
-DUSE_LOG4CPLUS=OFF -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr ../.. && \
make -j 16 && \
make install && \
cd /src/makems-1.5.4/test && \
makems WSRT_makems.cfg && \
rm -r /src/makems-1.5.4

#####################################################################
## BUILD MeqTrees from source
#####################################################################
WORKDIR /src

# Get MeqTrees universe python packages
RUN python3.8 -m pip install purr owlcat kittens 'meqtrees-cattery>=1.7.6' astro-tigger-lsm

ADD . /code
RUN mkdir /code/build && \
cd /code/build && \
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_PYTHON_3=ON \
.. && \
make -j4 && \
make install && \
rm -r /code/build && \
ldconfig


#####################################################################
## Run tests
#####################################################################

# basic install tests
RUN flag-ms.py --help
RUN meqtree-pipeliner.py --help
RUN pyxis --help

# run test when built
WORKDIR /src
RUN pip3 install nose && \
wget https://github.com/ska-sa/pyxis/archive/v1.7.4.3.tar.gz && \
tar -xvf v1.7.4.3.tar.gz && \
rm v1.7.4.3.tar.gz && \
python3.8 -m pip install /src/pyxis-1.7.4.3 && \
cd /src/pyxis-1.7.4.3/Pyxis/recipes/meqtrees-batch-test && \
python3 -m "nose" && \
rm -r /src/pyxis-1.7.4.3

ENTRYPOINT ["meqtree-pipeliner.py"]
CMD ["--help"]
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git
build
Dockerfile
.ci
110 changes: 0 additions & 110 deletions .travis/py3.docker

This file was deleted.

4 changes: 2 additions & 2 deletions AppAgent/AppUtils/src/MSInputChannel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,9 @@ int MSInputChannel::refillStream ()
predcube.reverseSelf(blitz::secondDim);
}
// get vector of row numbers
Vector<uInt> rownums = table.rowNumbers(ms_);
auto rownums = table.rowNumbers(ms_);
// now process rows one by one
for( int i=0; i<nrows; i++ )
for( size_t i=0; i<nrows; i++ )
{
int ant1 = ant1col(i), ant2 = ant2col(i);
if( ant1 < 0 || ant1 >= num_antennas_ )
Expand Down
7 changes: 6 additions & 1 deletion AppAgent/AppUtils/src/wsrt_j2convert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
//# $Id: j2convert.cc,v 19.3 2004/11/30 17:50:39 ddebonis Exp $

//# Includes
#include <casacore/casa/version.h>
#include <casacore/measures/Measures/Muvw.h>
#include <casacore/measures/Measures/MCBaseline.h>
#include <casacore/measures/Measures/MBaseline.h>
Expand Down Expand Up @@ -56,7 +57,11 @@
#include <casacore/measures/TableMeasures/TableMeasRefDesc.h>
#include <casacore/casa/Arrays/Vector.h>
#include <casacore/casa/Arrays/ArrayMath.h>
#include <casacore/casa/Arrays/ArrayIO.h>
#if CASACORE_MAJOR_VERSION <= 3 && CASACORE_MINOR_VERSION < 4
#include <casacore/casa/Arrays/ArrayIO.h>
#else
#include <casacore/casa/IO/ArrayIO.h>
#endif
#include <casacore/casa/Arrays/MatrixMath.h>
#include <casacore/casa/System/ProgressMeter.h>
#include <casacore/casa/Inputs.h>
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ cd $PROJECTS_DIR/meqtrees-timba
IMAGENAME="mttimbapr"

# build and test
docker build -f .travis/py3.docker -t "${IMAGENAME}36:$BUILD_NUMBER" --no-cache=true .
docker build -f .ci/py3.docker -t "${IMAGENAME}36:$BUILD_NUMBER" --no-cache=true .
6 changes: 3 additions & 3 deletions MeqNodes/src/CasaParmTable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ int CasaParmTable::getFunklets (vector<Funklet::Ref> &funklets,
if(itsTable.actualTableDesc().isColumn(ColFunkletType))
ftypeCol.attach(sel, ColFunkletType);
ROArrayColumn<double> lscaleCol;
Vector<uInt> rowNums = sel.rowNumbers(itsTable);
auto rowNums = sel.rowNumbers(itsTable);
int axis[] = { Axis::TIME,Axis::FREQ };
for( uint i=0; i<sel.nrow(); i++ )
{
Expand Down Expand Up @@ -272,7 +272,7 @@ int CasaParmTable::getInitCoeff (Funklet::Ref &funkletref,const string& parmName
while( true )
{
*itsInitIndexName = name;
Vector<uInt> rownrs = itsInitIndex->getRowNumbers();
auto rownrs = itsInitIndex->getRowNumbers();
if (rownrs.nelements() > 0)
{
Assert( rownrs.nelements() == 1 );
Expand Down Expand Up @@ -454,7 +454,7 @@ Table CasaParmTable::find (const string& parmName,
// First see if the parameter name exists at all.
Table result;
*itsIndexName = parmName;
Vector<uInt> rownrs = itsIndex.getRowNumbers();
auto rownrs = itsIndex.getRowNumbers();
if (rownrs.nelements() > 0) {
Table sel = itsTable(rownrs);
// Find all rows overlapping the requested domain.
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindPythonNumpy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import numpy;print(numpy.get_in
OUTPUT_STRIP_TRAILING_WHITESPACE)

IF ( ${NUMPY_FIND_RESULT} )
MESSAGE( "python -c 'import numpy' appears to fail. Is numpy installed?" )
MESSAGE( "python3 -c 'import numpy' appears to fail. Is numpy installed?" )
SET(PYTHON_NUMPY_INCLUDE_DIR)
FIND_PATH(PYTHON_NUMPY_INCLUDE_DIR numpy)
ENDIF ( ${NUMPY_FIND_RESULT} )
Expand Down

0 comments on commit 04a1c8b

Please sign in to comment.