Skip to content

Commit

Permalink
Update lcov and env documentation (CICE-Consortium#476)
Browse files Browse the repository at this point in the history
* update lcov and env documentation

* update documentation
  • Loading branch information
apcraig authored Jun 29, 2020
1 parent c9cfebd commit c6c20bf
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 18 deletions.
16 changes: 12 additions & 4 deletions cice.setup
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ DESCRIPTION
--setvers : updates cice version number in sandbox
--case, -c : case, case directory/name (not with --test or --suite)
--mach, -m : machine, machine name (required)
--env, -e : envname(s), comma separated (default = $envnames)
--env, -e : compilation environment name(s), comma separated (default = $envnames)
--pes, -p : tasks x threads [x blocksize_x x blocksize_y [x maxblocks]] (default is ${pesx})
--acct : account number for the batch submission
--grid, -g : grid, grid (default = ${grid})
Expand All @@ -112,7 +112,7 @@ DESCRIPTION
--diff : generate comparison against another case
--report : automatically post results when tests are complete
--coverage : generate and report test coverage metrics when tests are complete,
requires GNU env (--env gnu*)
requires GNU compiler (ie. normally ``--env gnu``)
--setup-only : for suite, setup testcases, no build, no submission
--setup-build : for suite, setup and build testcases, no submission
--setup-build-run : for suite, setup, build, and run interactively
Expand Down Expand Up @@ -529,7 +529,6 @@ if !(\$?CODECOV_TOKEN) then
endif
#for lcov
setenv PERL5LIB ~/usr/lib/perl5/site_perl/5.18.2/x86_64-linux-thread-multi/
set lcovalist = ""
EOF0
Expand Down Expand Up @@ -791,14 +790,23 @@ EOF
end
# from basic script dir to casescr
foreach file (parse_namelist.sh parse_settings.sh parse_namelist_from_env.sh cice_decomp.csh cice.run.setup.csh cice.test.setup.csh cice.results.csh cice.codecov.csh cice.lcov.csh)
foreach file (parse_namelist.sh parse_settings.sh parse_namelist_from_env.sh cice_decomp.csh cice.run.setup.csh cice.test.setup.csh)
if !(-e ${ICE_SCRIPTS}/$file) then
echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found"
exit -1
endif
cp -f -p ${ICE_SCRIPTS}/$file ${casescr}/
end
# from tests dir to casescr
foreach file (cice.results.csh cice.codecov.csh cice.lcov.csh)
if !(-e ${ICE_SCRIPTS}/tests/$file) then
echo "${0}: ERROR, ${ICE_SCRIPTS}/$file not found"
exit -1
endif
cp -f -p ${ICE_SCRIPTS}/tests/$file ${casescr}/
end
cd ${casedir}
set quietmode = false
Expand Down
20 changes: 20 additions & 0 deletions configuration/scripts/machines/env.cheyenne_gnu
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,23 @@ setenv ICE_MACHINE_QUEUE "regular"
setenv ICE_MACHINE_TPNODE 36
setenv ICE_MACHINE_BLDTHRDS 1
setenv ICE_MACHINE_QSTAT "qstat "

# For lcov
set lcovpath = "/glade/u/home/tcraig/bin"
set lcovp5l = "/glade/u/home/tcraig/usr/lib/perl5/site_perl/5.18.2/x86_64-linux-thread-multi"

if ($?PATH) then
if ("$PATH" !~ "*${lcovpath}*") then
setenv PATH ${PATH}:$lcovpath
endif
else
setenv PATH $lcovpath
endif

if ($?PERL5LIB) then
if ("$PERL5LIB" !~ "*${lcovp5l}*") then
setenv PERL5LIB ${PERL5LIB}:$lcovp5l
endif
else
setenv PERL5LIB $lcovp5l
endif
20 changes: 20 additions & 0 deletions configuration/scripts/machines/env.conrad_gnu
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,23 @@ setenv ICE_MACHINE_QUEUE "debug"
setenv ICE_MACHINE_TPNODE 32 # tasks per node
setenv ICE_MACHINE_BLDTHRDS 4
setenv ICE_MACHINE_QSTAT "qstat "

# For lcov
set lcovpath = "/p/home/apcraig/bin"
set lcovp5l = "/p/home/apcraig/usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi"

if ($?PATH) then
if ("$PATH" !~ "*${lcovpath}*") then
setenv PATH ${PATH}:$lcovpath
endif
else
setenv PATH $lcovpath
endif

if ($?PERL5LIB) then
if ("$PERL5LIB" !~ "*${lcovp5l}*") then
setenv PERL5LIB ${PERL5LIB}:$lcovp5l
endif
else
setenv PERL5LIB $lcovp5l
endif
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ set lcovrepo = apcraig.github.io
set lcovhtmldir = lcov_cice_${report_name}
genhtml -o ./${lcovhtmldir} --precision 2 -t "${report_name}" total.info

rm -r -f ${lcovrepo}
git clone https://github.com/apcraig/${lcovrepo}
cp -p -r ${lcovhtmldir} ${lcovrepo}/

cd ${lcovrepo}
set covp0 = `grep message coverage.json | cut -d : -f 2 | cut -d \" -f 2 | cut -d % -f 1`
set covp = `grep -i headerCovTableEntryLo ${lcovhtmldir}/index.html | head -1 | cut -d \> -f 2 | cut -d % -f 1`
set covp = `grep -i headerCovTableEntry ${lcovhtmldir}/index.html | grep % | head -1 | cut -d \> -f 2 | cut -d % -f 1`
set covpi = `echo $covp | cut -d . -f 1`

set lcovhtmlname = "${covpi}%:${report_name}"
Expand Down
File renamed without changes.
28 changes: 15 additions & 13 deletions doc/source/user_guide/ug_running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,23 @@ There are three usage modes,
* ``--test`` creates individual tests. Tests are just cases that have some extra automation in order to carry out particular tests such as exact restart.
* ``--suite`` creates a test suite. Test suites are predefined sets of tests and ``--suite`` provides the ability to quickly setup, build, and run a full suite of tests.

All modes will require use of ``--mach`` or ``-m`` to specify the machine and case and test modes
can use ``--set`` or ``-s`` to define specific options. ``--test`` and ``--suite`` will require ``--testid`` to be set
and both of the test modes can use ``--bdir``, ``--bgen``, ``--bcmp``, and ``--diff`` to generate (save) results and compare results with prior results as well as ``--tdir`` to specify the location of the test directory.
All modes will require use of ``--mach`` or ``-m`` to specify the machine. Use of ``--env`` is also recommended to specify the compilation environment. ``--case`` and ``--test`` modes can use ``--set`` or ``-s`` which will turn on various model options. ``--test`` and ``--suite`` will require ``--testid`` to be set and can use ``--bdir``, ``--bgen``, ``--bcmp``, and ``--diff`` to generate (save) results for regression testing (comparison with prior results). ``--tdir`` will specify the location of the test directory.
Testing will be described in greater detail in the :ref:`testing` section.

Again, ``cice.setup --help`` will show the latest usage information including
the available ``--set`` options, the current ported machines, and the test choices.

To create a case, run **cice.setup**::

cice.setup -c mycase -m machine
cice.setup -c mycase -m machine -e intel
cd mycase

Once a case/test is created, several files are placed in the case directory

- **env.[machine]** defines the environment
- **env.[machine]_[env]** defines the environment
- **cice.settings** defines many variables associated with building and running the model
- **makdep.c** is a tool that will automatically generate the make dependencies
- **Macros.[machine]** defines the Makefile macros
- **Macros.[machine]_[env]** defines the Makefile macros
- **Makefile** is the makefile used to build the model
- **cice.build** is a script that calls the Makefile and compiles the model
- **ice\_in** is the namelist input file
Expand All @@ -137,8 +135,8 @@ The **casescripts/** directory holds scripts used to create the case and can
largely be ignored. Once a case is created, the **cice.build** script should be run
interactively and then the case should be submitted by executing the
**cice.submit** script interactively. The **cice.submit** script
simply submits the **cice.run script**.
You can also submit the **cice.run** script on the command line.
submits the **cice.run script** or **cice.test** script. These scripts can
also be run interactively or submitted manually without the **cice.submit** script.

Some hints:

Expand All @@ -158,7 +156,7 @@ To build and run::
./cice.build
./cice.submit

The build and run log files will be copied into the logs directory in the case directory.
The build and run log files will be copied into the logs subdirectory in the case directory.
Other model output will be in the run directory. The run directory is set in **cice.settings**
via the ``ICE_RUNDIR`` variable. To modify the case setup, changes should be made in the
case directory, NOT the run directory.
Expand Down Expand Up @@ -186,10 +184,10 @@ Testing will be described in greater detail in the :ref:`testing` section.
specifies the case name. This can be either a relative path of an absolute path. This cannot be used with --test or --suite. Either ``--case``, ``--test``, or ``--suite`` is required.

``--mach``, ``-m`` MACHINE
specifies the machine name. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. This is required in all modes.
specifies the machine name. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. This is required in all modes and is paired with ``--env`` to define the compilation environment.

``--env``, ``-e`` ENVIRONMENT1,ENVIRONMENT2,ENVIRONMENT3
specifies the environment or compiler associated with the machine. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. Each machine can have multiple supported environments including support for different compilers or other system setups. When used with ``--suite`` or ``--test``, the ENVIRONMENT can be a set of comma deliminated values with no spaces and the tests will then be run for all of those environments. With ``--case``, only one ENVIRONMENT should be specified. (default is intel)
specifies the compilation environment associated with the machine. This should be consistent with the name defined in the Macros and env files in **configurations/scripts/machines**. Each machine can have multiple supported environments including support for different compilers, different compiler versions, different mpi libraries, or other system settigs. When used with ``--suite`` or ``--test``, the ENVIRONMENT can be a set of comma deliminated values with no spaces and the tests will then be run for all of those environments. With ``--case``, only one ENVIRONMENT should be specified. (default is intel)

``--pes``, ``-p`` MxN[[xBXxBY[xMB]
specifies the number of tasks and threads the case should be run on. This only works with ``--case``. The format is tasks x threads or "M"x"N" where M is tasks and N is threads and both are integers. BX, BY, and MB can also be set via this option where BX is the x-direction blocksize, BY is the y-direction blocksize, and MB is the max-blocks setting. If BX, BY, and MB are not set, they will be computed automatically based on the grid size and the task/thread count. More specifically, this option has three modes, --pes MxN, --pes MxNxBXxBY, and --pes MxNxBXxBYxMB. (default is 4x1)
Expand Down Expand Up @@ -229,7 +227,7 @@ files **configuration/scripts/ice_in** and
settings (options), the set_env.setting and set_nml.setting will be used to
change the defaults. This is done as part of the ``cice.setup`` and the
modifications are resolved in the **cice.settings** and **ice_in** file placed in
the case directory. If multiple options are chosen and then conflict, then the last
the case directory. If multiple options are chosen that conflict, then the last
option chosen takes precedent. Not all options are compatible with each other.

Some of the options are
Expand Down Expand Up @@ -372,7 +370,10 @@ To port, an **env.[machine]_[environment]** and **Macros.[machine]_[environment]
**configuration/scripts/machines/** directory and the
**configuration/scripts/cice.batch.csh** and **configuration/scripts/cice.launch.csh** files need to be modified.
In general, the machine is specified in ``cice.setup`` with ``--mach``
and the environment (compiler) is specified with ``--env``.
and the environment (compiler) is specified with ``--env``. mach and env
in combination define the compiler, compiler version, supporting libaries,
and batch information. Multiple compilation environments can be created for
a single machine by choosing unique env names.

- cd to **configuration/scripts/machines/**

Expand Down Expand Up @@ -435,6 +436,7 @@ system. Some variables are optional.

Cross-compiling
~~~~~~~~~~~~~~~

It can happen that the model must be built on a platform and run on another, for example when the run environment is only available in a batch queue. The program **makdep** (see :ref:`overview`), however, is both compiled and run as part of the build process.

In order to support this, the Makefile uses a variable ``CFLAGS_HOST`` that can hold compiler flags specfic to the build machine for the compilation of makdep. If this feature is needed, add the variable ``CFLAGS_HOST`` to the **Macros.[machine]_[environment]** file. For example : ::
Expand Down

0 comments on commit c6c20bf

Please sign in to comment.