Skip to content

Commit

Permalink
merging in master
Browse files Browse the repository at this point in the history
  • Loading branch information
dkeeney committed May 10, 2019
2 parents 4c88aed + d5dbb33 commit 7844c2e
Show file tree
Hide file tree
Showing 66 changed files with 1,740 additions and 2,418 deletions.
80 changes: 55 additions & 25 deletions circle.yml → .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# CircleCI Build Config
# https://circleci.com/docs/2.0/configuration-reference/#section=configuration
#
# Targets:
# - Max OS/X
# - ARM64

version: 2
jobs:

# job: Mac OS/X raw ("build-and-test")
build-and-test:
macos:
xcode: '10.1.0'
Expand All @@ -22,13 +31,12 @@ jobs:
name: Restoring system python
command: |
echo 'python version: ' && python --version
echo 'pip version: ' && python -m pip --version
echo 'pip version: ' && python -m pip --version
echo 'python version: ' && python --version
- run:
name: Installing cmake
name: Installing cmake
command: brew install cmake || brew install cmake
- checkout

# Dependencies
# Restore the dependency cache
# - restore_cache:
Expand All @@ -37,21 +45,19 @@ jobs:
# - v1-dep-{{ .Branch }}-
# # Default branch if not
# - v1-dep-master-
# # Any branch if there are none on the default branch - this should be
# # Any branch if there are none on the default branch - this should be
# # unnecessary if you have your default branch configured correctly
# - v1-dep-

- run:
name: Installing python dependencies
command: |
python -m pip install --user --upgrade pip setuptools setuptools-scm
python -m pip install --no-cache-dir --user -r bindings/py/packaging/requirements.txt --verbose || exit
# Save dependency cache
# - save_cache:
# key: v1-dep-{{ .Branch }}-{{ epoch }}
# paths:
# # This is a broad list of cache paths to include many possible
# # This is a broad list of cache paths to include many possible
# # development environments.
# - vendor/bundle
# - ~/virtualenvs
Expand All @@ -61,48 +67,40 @@ jobs:
# - ~/.go_workspace
# - ~/.gradle
# - ~/.cache/bower

# Build
# Build
- run:
name: Compiling
environment:
VERBOSE: 1
command: |
mkdir -p build/scripts
cd build/scripts
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../Release
make | grep -v -F '\\-\\- Installing:'
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../Release
make -j2 | grep -v -F '\\-\\- Installing:'
make install 2>&1 | grep -v -F 'Installing:'
- run:
name: Install Python extension
command: python setup.py install --user --prefix=

# Test
- run:
name: Running C++ Tests
command: |
mkdir -p $CIRCLE_WORKING_DIRECTORY/tests/cpp
cd ./build/Release/bin
./unit_tests --gtest_output=xml:$CIRCLE_WORKING_DIRECTORY/tests/cpp/unit_tests_report.xml
mkdir -p $CIRCLE_WORKING_DIRECTORY/tests/cpp
cd ./build/Release/bin
./unit_tests --gtest_output=xml:$CIRCLE_WORKING_DIRECTORY/tests/cpp/unit_tests_report.xml
- run:
name: Install Python extension
command: python setup.py install --user --prefix=
- run:
name: Running python tests
command: python setup.py test


- store_test_results:
path: tests

- store_artifacts:
path: dist/*.whl

##- persist_to_workspace:
## root: dist
## paths:
## - nupic.bindings*.whl
## - requirements.txt
## - include/nupic

# deploy-s3:
#machine: true
#steps:
Expand All @@ -115,8 +113,40 @@ jobs:
#tar -zcv -f nupic_core-${CIRCLE_SHA1}-darwin64.tar.gz dist
#aws s3 cp nupic_core-${CIRCLE_SHA1}-darwin64.tar.gz s3://artifacts.numenta.org/numenta/nupic.core/circle/

# job: ARM64 via Docker + QEMU ("arm64-build-test")
arm64-build-test:
parallelism: 1
docker:
# CircleCI base Ubuntu 18.04 LTS Bionic with remote Docker access, etc.
# https://circleci.com/docs/2.0/circleci-images/#buildpack-deps
- image: circleci/buildpack-deps:bionic
steps:
- run:
# This is for local test builds using the CircleCI terminal app.
# Local Docker seems to use sudo, CircleCI Docker does not.
command: |
if [[ $CIRCLE_SHELL_ENV == *"localbuild"* ]]; then
echo "This is a local build. Enabling sudo for docker"
echo 'export CI_SUDO="sudo"' >> $BASH_ENV
else
echo 'export CI_SUDO=' >> $BASH_ENV
fi
source $BASH_ENV
- run: sudo apt-get -y install qemu-system
- checkout
- setup_remote_docker # access circleci's custom docker service
# here we make circleci x86 hardware think it's arm64 via docker+qemu
- run: $CI_SUDO docker run --rm --privileged multiarch/qemu-user-static:register --reset
- run:
name: Running docker build on ARM64
command: $CI_SUDO docker build -t nupic-arm64-docker --build-arg arch=arm64 .
no_output_timeout: 2h
- run: $CI_SUDO docker run -it nupic-arm64-docker

workflows:
version: 2
build-test-deploy:
jobs:
- build-and-test
- build-and-test # Mac OS/X raw ("build-and-test")
- arm64-build-test # ARM64 docker/qemu ("arm64-build-test")

11 changes: 11 additions & 0 deletions API_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,16 @@ longer accept a synapse permanence threshold argument. PR #305

* SDRClassifier class is replaced by `Classifier` and `Predictor` classes.


* In NetworkAPI, access to a Region object was accessed using `net.getRegions()->getByName('name');`.
This is obsolete. Use getRegion('name') instead.

* Anomaly class removed as obsolete, use `TM.anomaly` which is simpler to use, and `MovingAverage` when you need to emulate
running averages. Internaly the code still uses `computeRawAnomalyScore()` but there's no need to call it directly. `AnomalyLikelihood`
is still available and can be used in addition to TM.getAnomalyScore(). PR #406

* TemporalMemory::getPredictiveCells() now returns a SDR. This ensures more convenient API and that the SDR object has correct
dimensions matching TM. use TM.getPredictiveCells().getSparse() to obtain the sparse vector as before. PR #437, #442

* TemporalMemory `compute()` and `activateCells()` now use only SDR variants, old overloads with C-style arrays removed. Bindings and
tests also updated.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ message(STATUS "BITNESS = ${BITNESS}")
message(STATUS "NEEDS_BOOST = ${NEEDS_BOOST}")
message(STATUS "INTERNAL_CXX_FLAGS = ${INTERNAL_CXX_FLAGS}")
message(STATUS "INTERNAL_LINKER_FLAGS= ${INTERNAL_LINKER_FLAGS}")
message(STATUS "INTERNAL_LINKER_FLAGS_STR= ${INTERNAL_LINKER_FLAGS_STR}")
message(STATUS "COMMON_COMPILER_DEFINITIONS_STR=${COMMON_COMPILER_DEFINITIONS_STR}")
message(STATUS "COMMON_OS_LIBS = ${COMMON_OS_LIBS}")

Expand Down
26 changes: 10 additions & 16 deletions CommonCompilerConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ if(MSVC)
$<$<CONFIG:Debug>:/Ob0 /Od /Zi /sdl /RTC1 /MDd>)
#linker flags
if("${BITNESS}" STREQUAL "32")
set(machine "/MACHINE:X86")
set(machine "-MACHINE:X86")
else()
set(machine "/MACHINE:X${BITNESS}")
set(machine "-MACHINE:X${BITNESS}")
endif()
set(INTERNAL_LINKER_FLAGS "${machine} /NOLOGO /SAFESEH:NO /NODEFAULTLIB:LIBCMT /ignore:4099 /LTCG")
set(INTERNAL_LINKER_FLAGS ${machine} -NOLOGO -NODEFAULTLIB:LIBCMT -ignore:4099 $<$<CONFIG:Release>:-LTCG>)

set(COMMON_COMPILER_DEFINITIONS
_CONSOLE
Expand Down Expand Up @@ -409,19 +409,13 @@ endif()
#
# Provide a string variant of the COMMON_COMPILER_DEFINITIONS list
#
set(COMMON_COMPILER_DEFINITIONS_STR)
foreach(compiler_definition ${COMMON_COMPILER_DEFINITIONS})
set(COMMON_COMPILER_DEFINITIONS_STR "${COMMON_COMPILER_DEFINITIONS_STR} ${compiler_definition}")
endforeach()
string (REPLACE ";" " " COMMON_COMPILER_DEFINITIONS_STR "${COMMON_COMPILER_DEFINITIONS}")

# Provide a string variant of the INTERNAL_CXX_FLAGS list
set(INTERNAL_CXX_FLAGS_STR)
foreach(flag_item ${INTERNAL_CXX_FLAGS})
set(INTERNAL_CXX_FLAGS_STR "${INTERNAL_CXX_FLAGS_STR} ${flag_item}")
endforeach()

set(INTERNAL_LINKER_FLAGS_STR)
foreach(flag_item ${INTERNAL_LINKER_FLAGS})
set(flags "${INTERNAL_LINKER_FLAGS_STR} ${flag_item}")
endforeach()
string (REPLACE ";" " " INTERNAL_CXX_FLAGS_STR "${INTERNAL_CXX_FLAGS}")

# Provide a string variant of the INTERNAL_LINKER_FLAGS list
string (REPLACE ";" " " INTERNAL_LINKER_FLAGS_STR "${INTERNAL_LINKER_FLAGS}")
set_property(GLOBAL PROPERTY LINK_LIBRARIES ${INTERNAL_LINKER_FLAGS})


48 changes: 25 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
FROM ubuntu:14.04
# Default arch. Pass in like "--build-arg arch=arm64".
# Our circleci arm64 build uses this specifically.
# https://docs.docker.com/engine/reference/commandline/build/
ARG arch=x86_64

RUN apt-get update && \
apt-get install -y \
curl \
wget \
# Multiarch Ubuntu Bionic 18.04. arches: x86_64, arm64, etc.
# https://hub.docker.com/r/multiarch/ubuntu-core/tags/
FROM multiarch/ubuntu-core:$arch-bionic

RUN apt-get update
RUN apt-get install -y \
git-core \
gcc \
g++ \
g++-8 \
cmake \
python \
python2.7 \
python2.7-dev \
zlib1g-dev \
bzip2 \
python-numpy \
libyaml-dev \
libyaml-0-2
RUN wget http://releases.numenta.org/pip/1ebd3cb7a5a3073058d0c9552ab074bd/get-pip.py -O - | python
python-pip

RUN pip install --upgrade setuptools
RUN pip install wheel

ENV CC gcc
ENV CXX g++

ADD . /usr/local/src/nupic.core
ENV CC gcc-8
ENV CXX g++-8

WORKDIR /usr/local/src/nupic.core
ADD . /usr/local/src/nupic.cpp
WORKDIR /usr/local/src/nupic.cpp

# Explicitly specify --cache-dir, --build, and --no-clean so that build
# artifacts may be extracted from the container later. Final built python
# packages can be found in /usr/local/src/nupic.core/bindings/py/dist

# packages can be found in /usr/local/src/nupic.cpp/bindings/py/dist
RUN pip install \
--cache-dir /usr/local/src/nupic.core/pip-cache \
--build /usr/local/src/nupic.core/pip-build \
--no-clean \
-r bindings/py/requirements.txt && \
python setup.py bdist bdist_dumb bdist_wheel sdist
# --cache-dir /usr/local/src/nupic.cpp/pip-cache \
# --build /usr/local/src/nupic.cpp/pip-build \
# --no-clean \
-r bindings/py/packaging/requirements.txt
RUN python setup.py install

Loading

0 comments on commit 7844c2e

Please sign in to comment.