Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Variorum Service to use Energy API. #579

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(CALIPER_MPI_EXAMPLE_APPS
collective-output-channel)
set(CALIPER_C_EXAMPLE_APPS
c-example
c-spinloop-example
cali-print-snapshot)
set(CALIPER_Fortran_EXAMPLE_APPS
fortran-example
Expand Down
39 changes: 39 additions & 0 deletions examples/apps/c-spinloop-example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) 2015-2022, Lawrence Livermore National Security, LLC.
// See top-level LICENSE file for details.

// A C Caliper instrumentation and ConfigManager example

// Usage: $ cali-basic-annotations <configuration-string>
// For example, "$ cali-basic-annotations runtime-report" will print a
// hierarchical runtime summary for all annotated regions.

#include <caliper/cali.h>

#include <stdio.h>
#include <unistd.h>
#include <string.h>

#define LARGE_NUM 50000000

void foo()
{
// Mark begin of the current function. Must be manually closed.
CALI_MARK_FUNCTION_BEGIN;
printf("Enter foo. Run a long spinloop\n");
long double res = 0.1;
uint64_t i;
for (i = 0; i < LARGE_NUM; i++)
{
res += res * i;
}
printf("Exit foo. \n");
// Mark the end of the current function
CALI_MARK_FUNCTION_END;
}

int main(int argc, char *argv[])
{
printf("Enter main. Call foo.\n");
foo();
printf("Exit main. \n");
}
6 changes: 4 additions & 2 deletions ext/gotcha/src/gotcha.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ struct Boundary {
int find_relro_boundary(struct dl_phdr_info *info, size_t size, void *data) {
struct Boundary *boundary = data;
int found = 0;
for (int i = 0; i < info->dlpi_phnum; ++i) {
int i = 0;
for (i = 0; i < info->dlpi_phnum; ++i) {
if (info->dlpi_phdr[i].p_type == PT_LOAD) {
if (strcmp(boundary->l_name, info->dlpi_name) == 0 &&
boundary->load_addr == info->dlpi_addr) {
Expand All @@ -249,7 +250,8 @@ int find_relro_boundary(struct dl_phdr_info *info, size_t size, void *data) {
}
}
if (found) {
for (int i = 0; i < info->dlpi_phnum; ++i) {
int i = 0;
for (i = 0; i < info->dlpi_phnum; ++i) {
if (info->dlpi_phdr[i].p_type == PT_GNU_RELRO) {
boundary->start_addr = boundary->load_addr + info->dlpi_phdr[i].p_vaddr;
boundary->end_addr = boundary->start_addr + info->dlpi_phdr[i].p_memsz;
Expand Down
3 changes: 2 additions & 1 deletion ext/gotcha/src/gotcha_dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ int lib_header_callback(struct dl_phdr_info *info, size_t size, void *data) {
struct Addrs *addrs = data;
const char *name = NULL;
ElfW(Addr) load_address;
for (int i = 0; i < info->dlpi_phnum; ++i) {
int i = 0;
for (i = 0; i < info->dlpi_phnum; ++i) {
if (info->dlpi_phdr[i].p_type == PT_LOAD) {
ElfW(Addr) base_addr = info->dlpi_addr;
ElfW(Addr) start_addr = base_addr + info->dlpi_phdr[i].p_vaddr;
Expand Down
11 changes: 8 additions & 3 deletions src/services/variorum/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
Variorum Service
================

The Variorum service implements a monitoring service of power usage at runtime.
The Variorum service implements a monitoring service of energy usage at runtime.
It implements the `snapshot` callback for adding data to Caliper snapshot
records.
records. Minimum Variorum version is v0.8.
Nesting of Caliper markers is not supported yet in this service.

To build with the Variorum service, set WITH_VARIORUM=On and
VARIORUM_PREFIX=<path-to-variorum-install>.

With the following configuration, Caliper will export its
data to a cali file:

```
$ CALI_SERVICES_ENABLE=aggregate,event,variorum,recorder \
CALI_VARIORUM_DOMAINS=power_node_watts \
CALI_VARIORUM_DOMAINS=energy_node_joules \
```

Loading
Loading