Unverified Commit cdf90b84 authored by Justin Carpentier's avatar Justin Carpentier Committed by GitHub
Browse files

Merge pull request #1430 from jcarpent/topic/ci

Extend CI coverage with OpenMP
parents 68382811 36db1735
Pipeline #14008 passed with stage
in 151 minutes and 50 seconds
name: Build Pinocchio for Mac OS X via Conda
name: Build Pinocchio for Mac OS X/Linux via Conda
on: [push,pull_request]
jobs:
pinocchio-osx-conda:
runs-on: macos-latest
pinocchio-conda:
name: Pinocchio on ${{ matrix.os }} with Conda
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest"]
steps:
- uses: actions/checkout@v2
......@@ -25,6 +31,7 @@ jobs:
run: |
conda activate pinocchio
conda install cmake -c main
conda install llvm-openmp -c conda-forge
- name: Build Pinocchio
shell: bash -l {0}
......@@ -35,7 +42,7 @@ jobs:
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Debug -DBUILD_WITH_COLLISION_SUPPORT=ON -DBUILD_ADVANCED_TESTING=ON -DBUILD_WITH_CASADI_SUPPORT=OFF -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_WITH_OPENMP_SUPPORT=OFF
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_COLLISION_SUPPORT=ON -DBUILD_ADVANCED_TESTING=ON -DBUILD_WITH_CASADI_SUPPORT=OFF -DPYTHON_EXECUTABLE=$(which python3) -DBUILD_WITH_OPENMP_SUPPORT=ON
make
make build_tests
export CTEST_OUTPUT_ON_FAILURE=1
......
......@@ -91,6 +91,12 @@ IF(BUILD_PYTHON_INTERFACE)
)
ENDIF(BUILD_WITH_URDF_SUPPORT)
ENDIF(hpp-fcl_FOUND)
IF(BUILD_WITH_OPENMP_SUPPORT)
LIST(APPEND ${PROJECT_NAME}_PYTHON_EXAMPLES
run-algo-in-parallel
)
ENDIF(BUILD_WITH_OPENMP_SUPPORT)
FOREACH(EXAMPLE ${${PROJECT_NAME}_PYTHON_EXAMPLES})
ADD_PYTHON_UNIT_TEST("example-py-${EXAMPLE}" "examples/${EXAMPLE}.py" "bindings/python")
......
import pinocchio as pin
import numpy as np
model = pin.buildSampleModelHumanoid()
model.lowerPositionLimit[:7] = -np.ones(7)
model.upperPositionLimit[:7] = +np.ones(7)
pool = pin.ModelPool(model)
num_threads = pin.omp_get_max_threads()
batch_size = 128
q = np.empty((model.nq,batch_size))
for k in range(batch_size):
q[:,k] = pin.randomConfiguration(model)
v = np.zeros((model.nv,batch_size))
a = np.zeros((model.nv,batch_size))
tau = np.zeros((model.nv,batch_size))
print("num_threads: {}".format(num_threads))
print("batch_size: {}".format(batch_size))
# Call RNEA
res_rnea = np.empty((model.nv,batch_size))
pin.rnea(num_threads,pool,q,v,a,res_rnea) # Without allocation
res_rnea2 = pin.rnea(num_threads,pool,q,v,a) # With allocation
# Call ABA
res_aba = np.empty((model.nv,batch_size))
pin.aba(num_threads,pool,q,v,tau,res_aba) # Without allocation
res_aba2 = pin.aba(num_threads,pool,q,v,tau) # With allocation
Markdown is supported
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