Skip to content

Commit

Permalink
add cmake openmp ci
Browse files Browse the repository at this point in the history
  • Loading branch information
bodono committed Apr 5, 2023
1 parent de2b5b7 commit a06b17d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/cmake_openmp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: CMake OpenMP

on: [push, pull_request]

jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
sudo apt-get install libopenblas-dev liblapack-dev
mkdir out
export INSTALL_DIR=$PWD/out
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INSTALL_DIR/lib
mkdir build
cd build
cmake -DUSE_OPENMP=ON -DBUILD_TESTING=ON -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_DIR ..
make
make install
ctest --output-on-failure
cd ../docs/src/examples/
gcc -I$INSTALL_DIR/include/scs -L$INSTALL_DIR/lib/ qp.c -o qp.out -lscsdir
./qp.out
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ message(STATUS "Printing is NOT ${NO_PRINTING}")
option(NO_READ_WRITE "Disables all read/write functionality" OFF)
message(STATUS "Read/write functionality is NOT ${NO_READ_WRITE}")

# Enable OpenMP support
option(USE_OPENMP "Compile with OpenMP support" OFF)
message(STATUS "OpenMP parallelization is ${USE_OPENMP}")

set(COMPILER_OPTS "-DUSE_LAPACK -DCTRLC")

# Primitive types
Expand All @@ -146,7 +150,12 @@ if(NO_READ_WRITE)
set(COMPILER_OPTS "-DNO_READ_WRITE=1 ${COMPILER_OPTS}")
endif()

if(USE_OPENMP)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
endif()

message(STATUS "COMPILER_OPTS = ${COMPILER_OPTS}")
message(STATUS "CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")

# TODO this is a hack that overwrites the scs_types.h file, we should find a way
# to do this that doesn't pollute the master directory.
Expand Down

0 comments on commit a06b17d

Please sign in to comment.