Skip to content

Commit 3b3115b

Browse files
authored
add python example, add install of examples (LLNL#256)
* add python example, add install of examples * test installed using examples instead those in src * appveyor: change how mpi vars are passed to cmake change how mpi vars are passed to cmake to avoid issues with cmake 3.10
1 parent 8e3292f commit 3b3115b

File tree

5 files changed

+147
-3
lines changed

5 files changed

+147
-3
lines changed

appveyor.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ environment:
77
ENABLE_PYTHON: ON
88
MINICONDA: C:\Miniconda
99
ENABLE_MPI: ON
10+
MPI_HOME: "C:/Program Files (x86)/Microsoft SDKs/MPI"
1011
- CMAKE_GENERATOR: "Visual Studio 14 2015"
1112
CONFIG: Release
1213
PYTHON_VERSION: 2.7
1314
BUILD_SHARED_LIBS: OFF
1415
ENABLE_PYTHON: OFF
1516
MINICONDA: C:\Miniconda
1617
ENABLE_MPI: ON
18+
MPI_HOME: "C:/Program Files (x86)/Microsoft SDKs/MPI"
1719

1820
init:
1921
# line endings magic
@@ -39,6 +41,13 @@ install:
3941
# Install MS-MPI SDK
4042
- ps: Start-FileDownload 'https://download.microsoft.com/download/B/2/E/B2EB83FE-98C2-4156-834A-E1711E6884FB/msmpisdk.msi'
4143
- msmpisdk.msi /passive
44+
45+
# Install CMake 3.9
46+
############################################################################
47+
- ps: Start-FileDownload 'https://cmake.org/files/v3.9/cmake-3.9.6-win64-x64.msi'
48+
- cmake-3.9.6-win64-x64.msi /passive
49+
- set PATH=C:\Program Files\CMake\bin;%PATH%
50+
- cmake --version
4251

4352
before_build:
4453
# remove some noisy warnings from Xamarin
@@ -51,7 +60,14 @@ before_build:
5160
#- cmake -Hsrc -Bbuild -G "%CMAKE_GENERATOR%" -DHDF5_DIR="C:\\Program Files\\HDF_Group\\HDF5\\1.8.18" -DENABLE_PYTHON=TRUE
5261
#
5362
# enable mpi support and use default python
54-
- cmake -Hsrc -Bbuild -G "%CMAKE_GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% -DENABLE_PYTHON=%ENABLE_PYTHON% -DENABLE_MPI=%ENABLE_MPI% -DMPI_HOME:PATH="C:/Program Files (x86)/Microsoft SDKs/MPI" -DMPI_C_INCLUDE_PATH:PATH="${MPI_HOME}/Include" -DMPI_C_LIBRARIES:PATH="${MPI_HOME}/Lib/x86/msmpi.lib" -DMPI_CXX_INCLUDE_PATH:PATH="${MPI_HOME}/Include" -DMPI_CXX_LIBRARIES:PATH="${MPI_HOME}/Lib/x86/msmpi.lib"
63+
- cmake -Hsrc -Bbuild -G "%CMAKE_GENERATOR%" ^
64+
-DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% ^
65+
-DENABLE_PYTHON=%ENABLE_PYTHON% ^
66+
-DENABLE_MPI=%ENABLE_MPI% ^
67+
-DMPI_C_INCLUDE_PATH:PATH="%MPI_HOME%/Include" ^
68+
-DMPI_C_LIBRARIES:PATH="%MPI_HOME%/Lib/x86/msmpi.lib" ^
69+
-DMPI_CXX_INCLUDE_PATH:PATH="%MPI_HOME%/Include" ^
70+
-DMPI_CXX_LIBRARIES:PATH="%MPI_HOME%/Lib/x86/msmpi.lib"
5571

5672
build_script:
5773
#build

scripts/ci/travis-test-build-examples-vs-install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fi
5656
##########################################
5757
# using with cmake example
5858
##########################################
59-
cd ${TRAVIS_BUILD_DIR}/src/examples/using-with-cmake
59+
cd ${TRAVIS_BUILD_DIR}/travis-debug-install/examples/using-with-cmake
6060
mkdir build
6161
cd build
6262
cmake -DCONDUIT_DIR=${TRAVIS_BUILD_DIR}/travis-debug-install ../
@@ -67,7 +67,7 @@ make
6767
##########################################
6868
# find spack installed HDF5_DIR
6969
export HDF5_DIR=`ls -d ${TRAVIS_BUILD_DIR}/uberenv_libs/spack/opt/spack/*/*/hdf5*`
70-
cd ${TRAVIS_BUILD_DIR}/src/examples/using-with-make
70+
cd ${TRAVIS_BUILD_DIR}/travis-debug-install/examples/using-with-make
7171
env CXX=${COMPILER_CXX} CONDUIT_DIR=${TRAVIS_BUILD_DIR}/travis-debug-install HDF5_DIR=${HDF5_DIR} make
7272
env LD_LIBRARY_PATH=${TRAVIS_BUILD_DIR}/travis-debug-install/lib/:${HDF5_DIR}/lib ./example
7373

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ include(cmake/SetupIncludes.cmake)
141141
################################
142142
add_subdirectory(libs)
143143

144+
################################
145+
# Add our examples
146+
################################
147+
add_subdirectory(examples)
148+
144149
################################
145150
# Add docs
146151
################################

src/examples/CMakeLists.txt

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
###############################################################################
2+
# Copyright (c) 2014-2017, Lawrence Livermore National Security, LLC.
3+
#
4+
# Produced at the Lawrence Livermore National Laboratory
5+
#
6+
# LLNL-CODE-666778
7+
#
8+
# All rights reserved.
9+
#
10+
# This file is part of Conduit.
11+
#
12+
# For details, see: http://software.llnl.gov/conduit/.
13+
#
14+
# Please also read conduit/LICENSE
15+
#
16+
# Redistribution and use in source and binary forms, with or without
17+
# modification, are permitted provided that the following conditions are met:
18+
#
19+
# * Redistributions of source code must retain the above copyright notice,
20+
# this list of conditions and the disclaimer below.
21+
#
22+
# * Redistributions in binary form must reproduce the above copyright notice,
23+
# this list of conditions and the disclaimer (as noted below) in the
24+
# documentation and/or other materials provided with the distribution.
25+
#
26+
# * Neither the name of the LLNS/LLNL nor the names of its contributors may
27+
# be used to endorse or promote products derived from this software without
28+
# specific prior written permission.
29+
#
30+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33+
# ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
34+
# LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
35+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37+
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38+
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41+
# POSSIBILITY OF SUCH DAMAGE.
42+
#
43+
###############################################################################
44+
45+
###############################################################################
46+
#
47+
# file: src/examples/CMakeLists.txt
48+
#
49+
###############################################################################
50+
51+
# install using and python examples
52+
install(DIRECTORY using-with-cmake using-with-make python
53+
DESTINATION examples)
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
###############################################################################
2+
# Copyright (c) 2014-2017, Lawrence Livermore National Security, LLC.
3+
#
4+
# Produced at the Lawrence Livermore National Laboratory
5+
#
6+
# LLNL-CODE-666778
7+
#
8+
# All rights reserved.
9+
#
10+
# This file is part of Conduit.
11+
#
12+
# For details, see: http://software.llnl.gov/conduit/.
13+
#
14+
# Please also read conduit/LICENSE
15+
#
16+
# Redistribution and use in source and binary forms, with or without
17+
# modification, are permitted provided that the following conditions are met:
18+
#
19+
# * Redistributions of source code must retain the above copyright notice,
20+
# this list of conditions and the disclaimer below.
21+
#
22+
# * Redistributions in binary form must reproduce the above copyright notice,
23+
# this list of conditions and the disclaimer (as noted below) in the
24+
# documentation and/or other materials provided with the distribution.
25+
#
26+
# * Neither the name of the LLNS/LLNL nor the names of its contributors may
27+
# be used to endorse or promote products derived from this software without
28+
# specific prior written permission.
29+
#
30+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33+
# ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
34+
# LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
35+
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36+
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37+
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38+
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40+
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41+
# POSSIBILITY OF SUCH DAMAGE.
42+
#
43+
###############################################################################
44+
45+
"""
46+
file: conduit_python_example.py
47+
48+
description:
49+
Basic conduit python usage
50+
51+
"""
52+
53+
import conduit
54+
import conduit.relay
55+
import conduit.blueprint
56+
57+
# print details about conduit
58+
print(conduit.about())
59+
print(conduit.relay.about())
60+
print(conduit.blueprint.about())
61+
62+
# create a conduit node
63+
n = conduit.Node()
64+
n["a/b/c/d/e/f/g"] = 42
65+
print(n)
66+
67+
68+
69+
70+

0 commit comments

Comments
 (0)