Difference between revisions of "How I created the release branches."

From opm
Jump to: navigation, search
(Created page with "=== Setup and local checkout === I created a local directory to hold the local checkout (and a subdir for the sources): mkdir release-opm cd release-opm mkdir src Then I...")
 
Line 12: Line 12:
 
  opm-parser
 
  opm-parser
 
  opm-material
 
  opm-material
 +
opm-output
 
  opm-core
 
  opm-core
 
  opm-grid
 
  opm-grid
opm-output
 
 
  opm-simulators
 
  opm-simulators
 
  opm-upscaling
 
  opm-upscaling
Line 43: Line 43:
  
 
After that, you will have repositories with ssh remotes to both "origin" (your clone) and "upstream" (the OPM main repo), so be careful.
 
After that, you will have repositories with ssh remotes to both "origin" (your clone) and "upstream" (the OPM main repo), so be careful.
 +
 +
=== Building locally ===
 +
 +
This step is strictly not necessary to do the release branching, but it is an important sanity check. For this we need some more files. The modules to build list in the file "modules_build":
 +
 +
opm-common
 +
opm-parser
 +
opm-material
 +
opm-output
 +
opm-core
 +
opm-grid
 +
opm-simulators
 +
opm-upscaling
 +
ewoms
 +
 +
A script for building in "build.bash":
 +
 +
#!/bin/bash
 +
 +
for m in $(cat modules_build); do
 +
    echo "==================================================="
 +
    echo "=        Building module: $m"
 +
    echo "==================================================="
 +
    (
 +
        cd src
 +
        builddir="$m-build"
 +
        if [ ! -d "$builddir" ]; then
 +
            mkdir "$builddir"
 +
            cd "$builddir"
 +
            cmake -C ../../releaseopts.cmake "../$m"
 +
            make -j 7
 +
            make test
 +
        else
 +
            echo "******** Skipping $m, build dir $builddir already exists."
 +
        fi
 +
    )
 +
done
 +
 +
And finally the CMake cache preload file I used, "releaseopts.cmake":
 +
 +
set(CMAKE_C_COMPILER "clang" CACHE STRING "C compiler")
 +
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "C++ compiler")
 +
set(CMAKE_Fortran_COMPILER "/usr/local/bin/gfortran" CACHE STRING "Fortran compiler")
 +
set(OPM_COMMON_ROOT "/Users/atgeirr/release-opm/src/opm-common" CACHE STRING "OPM build system")
 +
# set(DUNE_ROOT "/Users/atgeirr/dune" CACHE STRING "Dune core modules")
 +
set(CMAKE_PREFIX_PATH "/Users/atgeirr/dune/dune-istl"
 +
                      "/Users/atgeirr/dune/dune-common"
 +
                      "/Users/atgeirr/dune/dune-localfunctions"
 +
                      "/Users/atgeirr/dune/dune-grid"
 +
                      "/Users/atgeirr/dune/dune-geometry" CACHE STRING "Dune core modules")
 +
set(SUPERLU_ROOT "/Users/atgeirr/install/SuperLU_4.3" CACHE STRING "Path to SuperLU")
 +
set(PRECOMPILE_HEADERS OFF CACHE BOOL "Precompiled headers")
 +
set(SILENCE_EXTERNAL_WARNINGS ON CACHE BOOL "Silence warnings from external libraries")
 +
set(USE_MPI ON CACHE BOOL "Use MPI")
 +
set(USE_OPENMP OFF CACHE BOOL "Use OpenMP")
 +
set(USE_PTHREAD OFF CACHE BOOL "Use pthreads")
 +
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type")
 +
set (CMAKE_CXX_FLAGS
 +
        "-pipe -std=c++0x -pedantic -Wall -Wextra -Wformat-nonliteral -Wcast-align -Wpointer-arith -Wmissing-declarations -Wcast-qual -Wshadow -Wwrite-strings -Wchar-subscripts -Wredundant-decls -Wno-unused-local-typedef -Wno-keyword-macro -Wno-missing-braces"
 +
        CACHE STRING "Flags used by the compiler during all build types")
 +
set (CMAKE_C_FLAGS_DEBUG
 +
        "-O0 -g"
 +
        CACHE STRING "Flags used during Debug builds")
 +
set (CMAKE_CXX_FLAGS_DEBUG
 +
        "-O0 -g"
 +
        CACHE STRING "Flags used during Debug builds")
 +
set (CMAKE_C_FLAGS_RELEASE
 +
        "-O2 -DNDEBUG -march=native -mtune=native"
 +
        CACHE STRING "Flags used during Release builds")
 +
set (CMAKE_CXX_FLAGS_RELEASE
 +
        "-O2 -DNDEBUG -march=native -mtune=native"
 +
        CACHE STRING "Flags used during Release builds")

Revision as of 19:07, 25 October 2016

Setup and local checkout

I created a local directory to hold the local checkout (and a subdir for the sources):

mkdir release-opm
cd release-opm
mkdir src

Then I added the following as a file "modules",

opm-common
opm-parser
opm-material
opm-output
opm-core
opm-grid
opm-simulators
opm-upscaling
ewoms
opm-data
opm-utilities

and the following script as "checkout.bash"

#!/bin/bash

for m in $(cat modules); do
    echo "=== Checking out module: $m"
    (
        cd src;
        if [ ! -d "$m" ]; then
            git clone git@github.com:atgeirr/$m.git
            cd $m
            git remote add upstream git@github.com:OPM/$m.git
            git remote update
            git merge upstream/master
        else
            echo "Module $m already checked out."
        fi
    )
done

Then I ran the script, which takes some time since opm-data is quite large at this point. Also note that the script should be edited to use your GitHub user name instead of "atgeirr".

After that, you will have repositories with ssh remotes to both "origin" (your clone) and "upstream" (the OPM main repo), so be careful.

Building locally

This step is strictly not necessary to do the release branching, but it is an important sanity check. For this we need some more files. The modules to build list in the file "modules_build":

opm-common
opm-parser
opm-material
opm-output
opm-core
opm-grid
opm-simulators
opm-upscaling
ewoms

A script for building in "build.bash":

  1. !/bin/bash
for m in $(cat modules_build); do
    echo "==================================================="
    echo "=        Building module: $m"
    echo "==================================================="
    (
        cd src
        builddir="$m-build"
        if [ ! -d "$builddir" ]; then
            mkdir "$builddir"
            cd "$builddir"
            cmake -C ../../releaseopts.cmake "../$m"
            make -j 7
            make test
        else
            echo "******** Skipping $m, build dir $builddir already exists."
        fi
    )
done

And finally the CMake cache preload file I used, "releaseopts.cmake":

set(CMAKE_C_COMPILER "clang" CACHE STRING "C compiler")
set(CMAKE_CXX_COMPILER "clang++" CACHE STRING "C++ compiler")
set(CMAKE_Fortran_COMPILER "/usr/local/bin/gfortran" CACHE STRING "Fortran compiler")
set(OPM_COMMON_ROOT "/Users/atgeirr/release-opm/src/opm-common" CACHE STRING "OPM build system")
# set(DUNE_ROOT "/Users/atgeirr/dune" CACHE STRING "Dune core modules")
set(CMAKE_PREFIX_PATH "/Users/atgeirr/dune/dune-istl"
                      "/Users/atgeirr/dune/dune-common"
                      "/Users/atgeirr/dune/dune-localfunctions"
                      "/Users/atgeirr/dune/dune-grid"
                      "/Users/atgeirr/dune/dune-geometry" CACHE STRING "Dune core modules")
set(SUPERLU_ROOT "/Users/atgeirr/install/SuperLU_4.3" CACHE STRING "Path to SuperLU")
set(PRECOMPILE_HEADERS OFF CACHE BOOL "Precompiled headers")
set(SILENCE_EXTERNAL_WARNINGS ON CACHE BOOL "Silence warnings from external libraries")
set(USE_MPI ON CACHE BOOL "Use MPI")
set(USE_OPENMP OFF CACHE BOOL "Use OpenMP")
set(USE_PTHREAD OFF CACHE BOOL "Use pthreads")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type")
set (CMAKE_CXX_FLAGS
        "-pipe -std=c++0x -pedantic -Wall -Wextra -Wformat-nonliteral -Wcast-align -Wpointer-arith -Wmissing-declarations -Wcast-qual -Wshadow -Wwrite-strings -Wchar-subscripts -Wredundant-decls -Wno-unused-local-typedef -Wno-keyword-macro -Wno-missing-braces"
        CACHE STRING "Flags used by the compiler during all build types")
set (CMAKE_C_FLAGS_DEBUG
        "-O0 -g"
        CACHE STRING "Flags used during Debug builds")
set (CMAKE_CXX_FLAGS_DEBUG
        "-O0 -g"
        CACHE STRING "Flags used during Debug builds")
set (CMAKE_C_FLAGS_RELEASE
        "-O2 -DNDEBUG -march=native -mtune=native"
        CACHE STRING "Flags used during Release builds")
set (CMAKE_CXX_FLAGS_RELEASE
        "-O2 -DNDEBUG -march=native -mtune=native"
        CACHE STRING "Flags used during Release builds")