Skip to content

Commit

Permalink
updating docs, verified demos
Browse files Browse the repository at this point in the history
  • Loading branch information
fnrizzi committed Dec 4, 2021
1 parent 3fc2d95 commit 0e2008e
Show file tree
Hide file tree
Showing 94 changed files with 1,787 additions and 758 deletions.
15 changes: 10 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,26 @@ include_directories(${YAML_CPP_INCLUDE_DIR})

find_package(KokkosKernels REQUIRED)
link_libraries(dl ${YAML_CPP_LIBRARIES} Kokkos::kokkoskernels)
# Kokkos::BLAS Kokkos::LAPACK)

set(exeName1 shawExe)
add_executable(${exeName1}
# executables
add_executable(
shawExe
${CMAKE_CURRENT_SOURCE_DIR}/src/kokkos/main_fom.cc)

set(exeName2 extractStateFromSnaps)
add_executable(${exeName2}
add_executable(
extractStateFromSnaps
${CMAKE_CURRENT_SOURCE_DIR}/src/tools/main_extract_state_from_snaps.cc)

# tests
enable_testing()
add_subdirectory(tests)



# ---------------------
# REMOVE at some point
# ---------------------
# Kokkos::BLAS Kokkos::LAPACK)
#include_directories(${EIGEN_INCLUDE_DIR} ${YAMLCPP_INCLUDE_DIR} ${KOKKOS_INCLUDE_DIR})
#link_directories (${BLAS_LIB_DIR} ${YAMLCPP_LIB_DIR})
#link_libraries (dl ${OMPLINK} yaml-cpp Kokkos::kokkoskernels ${BLASLIBNAME} gfortran)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ def doPlot(panelId, t, data, key):
plt.subplot(panelId)
plt.grid('on')

plt.plot(t, data[key], '-o', color='m',
plt.plot(t, data[key], '-o', color='r',
markerfacecolor='none',
markersize=3, linewidth=1,
markersize=0, linewidth=2,
label="Receiver at " + key+'\u00b0')

lg = plt.legend(loc="upper right",
ncol=1, fontsize=15, labelspacing=.3,
handletextpad=0.2,
frameon=False, markerscale=0.75)
plt.setp(lg.get_texts(), color='w')
plt.setp(lg.get_texts(), color='gray')

plt.xlim([-50, 2050])
plt.xticks(np.linspace(0, 2000, 6), color='w')
plt.xticks(np.linspace(0, 2000, 6), color='gray')
plt.ylim([-1.6e-6, 1.6e-6])

ylab = r'$v_{\phi}(t)$'
plt.ylabel(ylab, fontsize=15)
plt.xlabel(r'Time (seconds)', fontsize=15)

ax = plt.gca()
mycolor = 'w'
mycolor = 'gray'
ax.xaxis.label.set_color(mycolor);
ax.tick_params(axis='x', colors=mycolor)
ax.yaxis.label.set_color(mycolor);
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,44 @@ def doPlot(panelId, t, data, angle, depths):
d3 = data['d3'][row, :]

plt.title("Seismogram for receiver at " + angle+'\u00b0',
fontsize=15, color='w')
fontsize=15, color='gray')

plt.plot(t, d0, '-o', color='m',
markerfacecolor='none',
markersize=1, linewidth=1.8,
markersize=0, linewidth=1.8,
label='With source depth='+depths[0]+' km')

plt.plot(t, d1, '-s', color='c',
markerfacecolor='none',
markersize=1, linewidth=1.8,
markersize=0, linewidth=1.8,
label='With source depth='+depths[1]+' km')

plt.plot(t, d2, '-*', color='r',
markerfacecolor='none',
markersize=1, linewidth=1.8,
markersize=0, linewidth=1.8,
label='With source depth='+depths[2]+' km')

plt.plot(t, d3, '-v', color='y',
markerfacecolor='none',
markersize=1, linewidth=1.8,
markersize=0, linewidth=1.8,
label='With source depth='+depths[3]+' km')

lg = plt.legend(loc="upper right",
ncol=1, fontsize=12, labelspacing=.3,
handletextpad=0.2,
frameon=False, markerscale=0.75)
plt.setp(lg.get_texts(), color='w')
plt.setp(lg.get_texts(), color='gray')

plt.xlim([-50, 2050])
plt.xticks(np.linspace(0, 2000, 6), color='w')
plt.xticks(np.linspace(0, 2000, 6), color='gray')
plt.ylim([-2.5e-6, 2.5e-6])

ylab = r'$v_{\phi}(t)$'
plt.ylabel(ylab, fontsize=15)
plt.xlabel(r'Time (seconds)', fontsize=15)

ax = plt.gca()
mycolor = 'w'
mycolor = 'gray'
ax.xaxis.label.set_color(mycolor);
ax.tick_params(axis='x', colors=mycolor)
ax.yaxis.label.set_color(mycolor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def doPlot(th, r, z, figID, bd, outName, title, plotSource=False):
fig1 = plt.figure(figID)
ax1 = fig1.add_subplot(111, projection='polar')

h1=ax1.pcolormesh(th, r, z, cmap=cm1, shading = "flat",
h1=ax1.pcolormesh(th, r, z, cmap=cm1, shading = "auto",
vmin=bd[0], vmax=bd[1], zorder=1)
ax1.set_ylim([cmbRadius, earthRadius])
ax1.set_yticks([]) #[3480, 5701, 6371])
Expand All @@ -47,7 +47,7 @@ def doPlot(th, r, z, figID, bd, outName, title, plotSource=False):
r'$\pi/2$', r'$2\pi/6$', r'$\pi/6$', r'$0$'],
fontsize=11)

ax1.set_title(title, fontsize=15, color='w')
ax1.set_title(title, fontsize=15, color='gray')
ax1.set_rorigin(-1)
plotEarthSurf(ax1)
plotCMB(ax1)
Expand All @@ -57,9 +57,9 @@ def doPlot(th, r, z, figID, bd, outName, title, plotSource=False):
if plotSource:
sourceRadius = earthRadius-640. #[km]
c = ax1.scatter(np.pi/2.01, sourceRadius, c='r', s=15)
ax1.text(np.pi/2.01, sourceRadius, "Source", horizontalalignment='center', verticalalignment='top', color='w')
ax1.text(np.pi/2.01, sourceRadius, "Source", horizontalalignment='center', verticalalignment='top', color='gray')

mycolor = 'w'
mycolor = 'gray'
ax1.xaxis.label.set_color(mycolor);
ax1.tick_params(axis='x', colors=mycolor)
ax1.yaxis.label.set_color(mycolor);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def doPlot(panelId, t, data, angle, depths):
d3 = data['d3'][row, :]

plt.title("Seismogram for receiver at " + angle+'\u00b0',
fontsize=15, color='w')
fontsize=15, color='gray')

plt.plot(t, d0, '-o', color='m',
markerfacecolor='none',
Expand All @@ -48,18 +48,18 @@ def doPlot(panelId, t, data, angle, depths):
ncol=1, fontsize=12, labelspacing=.3,
handletextpad=0.2,
frameon=False, markerscale=0.75)
plt.setp(lg.get_texts(), color='w')
plt.setp(lg.get_texts(), color='gray')

plt.xlim([-50, 2050])
plt.xticks(np.linspace(0, 2000, 6), color='w')
plt.xticks(np.linspace(0, 2000, 6), color='gray')
plt.ylim([-2.5e-6, 2.5e-6])

ylab = r'$v_{\phi}(t)$'
plt.ylabel(ylab, fontsize=15)
plt.xlabel(r'Time (seconds)', fontsize=15)

ax = plt.gca()
mycolor = 'w'
mycolor = 'gray'
ax.xaxis.label.set_color(mycolor);
ax.tick_params(axis='x', colors=mycolor)
ax.yaxis.label.set_color(mycolor);
Expand Down
Binary file modified docs/.doctrees/build_expert.doctree
Binary file not shown.
Binary file modified docs/.doctrees/build_stepbystep.doctree
Binary file not shown.
Binary file added docs/.doctrees/demo1.doctree
Binary file not shown.
Binary file added docs/.doctrees/demo2.doctree
Binary file not shown.
Binary file added docs/.doctrees/demo3.doctree
Binary file not shown.
Binary file modified docs/.doctrees/demo_rank1fom.doctree
Binary file not shown.
Binary file modified docs/.doctrees/demo_rank1fommulti.doctree
Binary file not shown.
Binary file modified docs/.doctrees/demo_rank2fom.doctree
Binary file not shown.
Binary file modified docs/.doctrees/demos.doctree
Binary file not shown.
Binary file modified docs/.doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/.doctrees/goveq.doctree
Binary file not shown.
Binary file modified docs/.doctrees/index.doctree
Binary file not shown.
Binary file added docs/.doctrees/performance.doctree
Binary file not shown.
Binary file modified docs/_images/demo1_f1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/demo1_f2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/demo1_f3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/demo1_f4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/demo2_f1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/demo2_f2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/demo2_f3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/_images/demo3_f1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/fom_cpu_ave.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions docs/_sources/build_expert.rst.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Building: "expert" mode
=======================

You need:
Prerequisites
-------------

* This repo: ``git clone https://github.com/Pressio/SHAW``

* C++14 compiler: we have tested this with GCC 8.3.1 and GCC 8.4.0
* C++14 compiler: we have tested this with GCC 8.3.1, GCC 8.4.0, GCC 10.2.0.

* ``CMake>=3.16.0``

Expand All @@ -17,20 +18,19 @@ You need:
* `yaml-cpp <https://github.com/jbeder/yaml-cpp>`_: last tested version ``0.7.0``


Then, as usual for a typical CMake project, you can do:
Build
-----

.. code-block:: shell
export CXX=<path-to-your-C++-compiler>
export SHAWDIR=<path-to-where-you-cloned-the-shaw-repository>
mkdir build && cd build
cmake \
-DKokkosKernels_DIR=<your-kernels-install-path>/lib/cmake/KokkosKernels/ \
-Dyaml-cpp_DIR=<your-yamlcpp-install-path>/share/cmake/ \
${SHAWDIR}
-DCMAKE_CXX_COMPILER=<fullpath-to-your-C++-compiler> \
-DKokkosKernels_DIR=<fullpath-to-your-kernels-install-path>/lib/cmake/KokkosKernels/ \
-Dyaml-cpp_DIR=<fullpath-to-your-yamlcpp-install-path>/share/cmake/ \
-B <fullpath-to-where-you-want-to-build-the-code> \
-S <fullpath-to-your-shaw-repository>
# from within your build dir
make -j4
# running the tests is advised
Expand Down
31 changes: 15 additions & 16 deletions docs/_sources/build_stepbystep.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ If you are reading this page, it likely is because you want
a simplified (automated) way the get this done,
so that you can minimize the extra effort
in building the TPLs needed and the SHAW code.
This page tries to address this: it provides a step-by-step
guide that leverages some scripts we have prepared to simplify this.
This page tries to do so providing a step-by-step
guide and some scripts we have prepared.


Prerequisites
Expand All @@ -28,35 +28,32 @@ Prerequisites
Step 1: Prepare environment
----------------------------

Let's make things easy:

.. code-block:: shell
export CXX=<path-to-your-C++14-compiler>
export SHAWDIR=<path-to-where-you-cloned-the-SHAW-repository>
export CXX=<fullpath-to-your-C++14-compiler>
export SHAWDIR=<fullpath-to-where-you-cloned-the-SHAW-repository>
export WORKDIR=${HOME}/myFirstShawBuild
mkdir -p ${WORKDIR}
Step 2: Build TPLs
--------------------------------
------------------

To simplify this part, we have prepared script that
automates getting the TPLs:
We have prepared a script that automates this:

.. code-block:: shell
cd ${SHAWDIR}/bash_scripts
bash build_tpls.sh ${WORKDIR} openmp
This script will fetch, build and install inside ``WORKDIR/tpls``
all TPLs needed: Kokkos-core, Kokkos-kernelas and yaml-cpp.
all TPLs needed: Kokkos-core, Kokkos-kernels and yaml-cpp.

.. Attention::

This will build Kokkos for host-only use with the OpenMP backend
but **without** any architecture specifications. This is on purpose,
This builds Kokkos with only the OpenMP backend and **without**
any architecture specifications. This is on purpose,
because this step is meant to be as generic and simple as possible to get
you started quickly. If you want to customize things, read
more on the `Kokkos github <https://github.com/kokkos>`_.
Expand Down Expand Up @@ -90,14 +87,16 @@ Step 3: Build SHAW
.. code-block:: shell
cd ${WORKDIR}
mkdir shaw-build && cd shaw-build
# note that here there is not need to specify compiler because
# cmake will automatically pick the up the env var CXX tha we
# already set above in step 1
cmake \
-DKokkosKernels_DIR=${WORKDIR}/tpls/kokkos-kernels-install/lib/cmake/KokkosKernels/ \
-Dyaml-cpp_DIR=${WORKDIR}/tpls/yamlcpp-install/share/cmake/ \
${SHAWDIR}
-B ${WORKDIR}/shaw-build \
-S ${SHAWDIR}
cd ${WORKDIR}/shaw-build
make -j4
# running the SHAW tests is advised
ctest
Loading

0 comments on commit 0e2008e

Please sign in to comment.