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

Gr740 #91

Open
wants to merge 4 commits into
base: devel
Choose a base branch
from
Open
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
24 changes: 23 additions & 1 deletion config/macros.m4
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ dnl AX_FLAGS_SAVE()
dnl AX_FLAGS_RESTORE()
])


# AX_SELECT_BINARY_TYPE
# ---------------------
# Check the binary type the user wants to build and verify whether it can be successfully built
Expand Down Expand Up @@ -1143,6 +1144,7 @@ AC_DEFUN([AX_PROG_COUNTERS],
[
AC_REQUIRE([AX_PROG_PMAPI])
AC_REQUIRE([AX_PROG_PAPI])
AC_REQUIRE([AX_PROG_L4STAT])

if test "${papi_paths}" = "not_set" ; then
if test "${target_os}" = "aix" ; then
Expand All @@ -1154,7 +1156,7 @@ AC_DEFUN([AX_PROG_COUNTERS],
fi
fi

if test "${PMAPI_ENABLED}" = "yes" -o "${PAPI_ENABLED}" = "yes" ; then
if test "${PMAPI_ENABLED}" = "yes" -o "${PAPI_ENABLED}" = "yes" -o "${L4STAT_ENABLED}" = "yes"; then
AC_DEFINE([USE_HARDWARE_COUNTERS], 1, [Enable HWC support])
use_hw_counters="1"
else
Expand All @@ -1167,6 +1169,26 @@ AC_DEFUN([AX_PROG_COUNTERS],
fi
])

# AX_PROG_L4STAT
# -------------
AC_DEFUN([AX_PROG_L4STAT],
[
AC_ARG_ENABLE(l4stat,
AC_HELP_STRING(
[--enable-l4stat],
[Enable L4STAT driver to gather CPU performance counters]
),
[enable_l4stat="${enableval}"],
[enable_l4stat="not_set"]
)

if test "${enable_l4stat}" = "yes" ; then
L4STAT_ENABLED="yes"
AC_DEFINE([L4STAT], [1], [L4STAT is used as API to gain access to CPU hwc])
fi

AM_CONDITIONAL(L4STAT, test "${L4STAT_ENABLED}" = "yes")
])

# AX_PROG_PMAPI
# -------------
Expand Down
23 changes: 14 additions & 9 deletions config/openmp.m4
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,20 @@ AC_DEFUN([AX_CHECK_OPENMP],
AC_DEFUN([AX_HAVE_SYNC_FETCH_AND_ADD],
[
AC_MSG_CHECKING([for __sync_fetch_and_add availability])
AC_TRY_LINK(
[ ],
[ volatile int i; __sync_fetch_and_add(&i,1); ],
[ have_sync_fetch_and_add="yes" ]
)

if test "${have_sync_fetch_and_add}" = "yes" ; then
AC_DEFINE([HAVE__SYNC_FETCH_AND_ADD], 1, [Define if __sync_fetch_and_add is available])
AC_MSG_RESULT([yes])
# GR740 has a non-functional __sync_fetch_and_add
if test "${IS_GR740_MACHINE}" = "no"; then
AC_TRY_LINK(
[ ],
[ volatile int i; __sync_fetch_and_add(&i,1); ],
[ have_sync_fetch_and_add="yes" ]
)

if test "${have_sync_fetch_and_add}" = "yes"; then
AC_DEFINE([HAVE__SYNC_FETCH_AND_ADD], 1, [Define if __sync_fetch_and_add is available])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
else
AC_MSG_RESULT([no])
fi
Expand Down
2 changes: 1 addition & 1 deletion config/posix-clock-macros.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -------------------
AC_DEFUN([AX_CHECK_POSIX_CLOCK],
[
if test "${Architecture}" = "arm" -o "${Architecture}" = "arm64" ; then
if test "${Architecture}" = "arm" -o "${Architecture}" = "arm64" -o "${Architecture}" = "sparc"; then
USE_POSIX_CLOCK="yes"
else
USE_POSIX_CLOCK="no"
Expand Down
6 changes: 4 additions & 2 deletions config/show-config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ AC_DEFUN([AX_SHOW_CONFIGURATION],
AX_JAVA_SHOW_CONFIGURATION

echo
if test "${PMAPI_ENABLED}" = "yes" -o "${PAPI_ENABLED}" = "yes" ; then
if test "${PMAPI_ENABLED}" = "yes" -o "${PAPI_ENABLED}" = "yes" -o "${L4STAT_ENABLED}" = "yes"; then
echo Performance counters: yes
if test "${PMAPI_ENABLED}" = "yes" ; then
echo -e \\\tPerformance API: PMAPI
else
elif test "${PAPI_ENABLED}" = "yes"; then
echo -e \\\tPerformance API: PAPI
echo -e \\\tPAPI home: ${PAPI_HOME}
echo -e \\\tSampling support: ${PAPI_SAMPLING_ENABLED}
else
echo -e \\\tPerformance API: L4STAT
fi
else
echo Performance counters: no
Expand Down
22 changes: 21 additions & 1 deletion config/system.m4
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ AC_DEFUN([AX_SYSTEM_TYPE],
target_os="linux"
fi

AC_ARG_ENABLE(gr740,
AC_HELP_STRING(
[--enable-gr740],
[Enable compilation for the GR740 board]
),
[enable_gr740="${enableval}"],
[enable_gr740="no"]
)
IS_GR740_MACHINE=${enable_gr740}
if test "${IS_GR740_MACHINE}" = "yes" ; then
target_cpu="sparc"
target_os="rtems"
fi
AM_CONDITIONAL(IS_GR740_MACHINE, test "${IS_GR740_MACHINE}" = "yes")

# Check if this is an Altix machine and if it has an /dev/mmtimer device
# (which is a global clock!)
AC_ARG_ENABLE(check-altix,
Expand Down Expand Up @@ -138,6 +153,8 @@ AC_DEFUN([AX_SYSTEM_TYPE],
AC_DEFINE([ARCH_MIPS], [1], [Define if architecture is MIPS]) ;;
sparc64 ) Architecture="sparc64"
AC_DEFINE([ARCH_SPARC64], [1], [Define if architecture is SPARC64]) ;;
sparc ) Architecture="sparc"
AC_DEFINE([ARCH_SPARC], [1], [Define if architecture is SPARC]) ;;
riscv64 )
Architecture="riscv"
if test "${target_cpu}" == "riscv64" ; then
Expand All @@ -163,6 +180,8 @@ AC_DEFUN([AX_SYSTEM_TYPE],
AC_DEFINE([OS_SOLARIS], [1], [Define if operating system is Solaris]) ;;
darwin* ) OperatingSystem="darwin"
AC_DEFINE([OS_DARWIN], [1], [Define if operating system is Darwin]) ;;
rtems* ) OperatingSystem="rtems"
AC_DEFINE([OS_RTEMS], [1], [Define if operating system is RTEMS]) ;;
esac

# Publish these defines for conditional compilation
Expand All @@ -180,8 +199,9 @@ AC_DEFUN([AX_SYSTEM_TYPE],
AM_CONDITIONAL(OS_DEC, test "${OperatingSystem}" = "dec" )
AM_CONDITIONAL(OS_IRIX, test "${OperatingSystem}" = "irix" )
AM_CONDITIONAL(OS_FREEBSD, test "${OperatingSystem}" = "freebsd" )
AM_CONDITIONAL(OS_DARWIN, test "${OperatingSystem}" = "darwin" )
AM_CONDITIONAL(OS_DARWIN, test "${OperatingSystem}" = "darwin" )
AM_CONDITIONAL(OS_SOLARIS, test "${OperatingSystem}" = "solaris" )
AM_CONDITIONAL(OS_RTEMS, test "${OperatingSystem}" = "rtems" )

# Special flags for specific systems or architectures
if test "${OperatingSystem}" = "freebsd" ; then
Expand Down
5 changes: 5 additions & 0 deletions config/ucontext.m4
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ AC_DEFUN([AX_CHECK_UCONTEXT],

AC_MSG_RESULT([${STRUCT_UCONTEXT_TYPE}])
if test "${STRUCT_UCONTEXT_TYPE}" = "unknown"; then
if test "${IS_GR740_MACHINE}" = "yes"; then
AC_MSG_WARN([Ucontext not available for GR740, sampling is driven by hardware timers])
else
AC_MSG_ERROR([Unknown definition of struct ucontext. Please check the definition in sys/ucontext.h or libc's ucontext.h and extend the configure macro])
fi

else
AC_DEFINE_UNQUOTED([STRUCT_UCONTEXT], ${STRUCT_UCONTEXT_TYPE}, [Definition of struct ucontext])
fi
Expand Down
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ AC_PROG_FC(${wanted_F_Compilers})

AM_CONDITIONAL(HAVE_FC, test "$FC" != "")

if test "${IS_SPARC64_MACHINE}" != "yes" ; then
if test "${IS_SPARC64_MACHINE}" != "yes" -a test "${IS_GR740_MACHINE}" != "yes" ; then
AC_FC_WRAPPERS
fi
AX_JAVA
Expand Down Expand Up @@ -472,10 +472,13 @@ AC_CHECK_SIZEOF(ssize_t,${size_t_size})
AC_CHECK_SIZEOF(size_t,${size_t_size})
AC_CHECK_SIZEOF(void*,${voidp_size})

# GR740 has a non-functional mallinfo structure
if test "${IS_GR740_MACHINE}" != "yes" ; then
emercadal marked this conversation as resolved.
Show resolved Hide resolved
AC_CHECK_MEMBER(struct mallinfo.arena,
[AC_DEFINE([HAVE_MALLINFO], [1], [Whether the system supports mallinfo structure])],
[],
[#include <malloc.h>])
fi

AC_CHECK_MEMBER(union perf_mem_data_src.val,
[AC_DEFINE([HAVE_PERF_MEM_DATA_SRC], [1], [Whether the system includes perf_mem_data_src/val])],
Expand Down
2 changes: 2 additions & 0 deletions src/common/num_hwc.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
# define MAX_HWC 8
# elif defined (ARCH_PPC)
# define MAX_HWC 8
# elif defined (OS_RTEMS)
# define MAX_HWC 4
# else
# define MAX_HWC 8
# endif
Expand Down
6 changes: 6 additions & 0 deletions src/common/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ int __Extrae_Utils_append_from_to_file (const char *source, const char *destinat

int __Extrae_Utils_rename_or_copy (char *origen, char *desti)
{
#if defined (OS_RTEMS)
/*
* Renaming to an already existing filename using NFS on GR740 caused errors so we delete the destination file first
*/
remove(desti);
#endif
if (rename (origen, desti) == -1)
{
if (errno == EXDEV)
Expand Down
1 change: 1 addition & 0 deletions src/common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ int xtr_random(void);
#endif

#define STRINGIFY(s) #s
#define TOSTRING(x) STRINGIFY(x)

#if DEBUG
# define DBG(x, ...) fprintf(stderr, "DEBUG: " x, ##__VA_ARGS__)
Expand Down
3 changes: 3 additions & 0 deletions src/loader/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ bin_PROGRAMS = extrae-loader
extrae_loader_SOURCES = \
extrae-loader.c

if !IS_GR740_MACHINE
extrae_loader_LDFLAGS = -ldl
endif

4 changes: 2 additions & 2 deletions src/merger/paraver/HardwareCounters.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,13 +619,13 @@ int HardwareCounters_Emit (int ptask, int task, int thread,
/* If using PAPI, they can be stored in absolute or relative manner,
* depending whether sampling was activated or not
*/
# if defined(SAMPLING_SUPPORT)
# if defined(SAMPLING_SUPPORT) && !defined(L4STAT)
if (SetHWCIds[cnt].local_id != NO_COUNTER && SetHWCIds[cnt].local_id != SAMPLE_COUNTER)
# else
if (SetHWCIds[cnt].local_id != NO_COUNTER)
# endif
{
# if defined(SAMPLING_SUPPORT)
# if defined(SAMPLING_SUPPORT) && !defined(L4STAT)
// Protect when counters are incorrect (major timestamp, lower counter value)
if (Event->HWCValues[cnt] >= Sthread->counters[cnt])
# endif
Expand Down
4 changes: 4 additions & 0 deletions src/merger/paraver/HardwareCounters.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ int check_if_uncore_in_PFM(char *event_name);
#elif defined(PMAPI_COUNTERS)
# define GET_PARAVER_CODE_FOR_HWC(x, name) (HWC_BASE_PMAPI + x)
# define LEGACY_HWC_COUNTER_TYPE(x) (HWC_BASE_PMAPI + x)
#elif defined(L4STAT)
# define HWC_L4STAT_BASE HWC_BASE_PAPI_PRESET
# define LEGACY_HWC_COUNTER_TYPE(x) HWC_L4STAT_BASE + ((x & 0x000000FF))
# define GET_PARAVER_CODE_FOR_HWC(x, name) LEGACY_HWC_COUNTER_TYPE(x)
#endif

void HardwareCounters_AssignGlobalID (int ptask, int local_id, char *definition);
Expand Down
13 changes: 13 additions & 0 deletions src/merger/paraver/labels.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,19 @@ int Labels_GeneratePCFfile (char *name, long long options)
return 0;
}

#if defined(OS_RTEMS)
void Labels_loadRTEMSSymbols(char *executable_path, struct input_t * IFiles)
{

char path_binary2[256];
strcpy(path_binary2,executable_path);
path_binary2[strlen(path_binary2)-strlen(".prv")] = (char) 0;
ObjectTable_AddBinaryObject (FALSE, IFiles[0].ptask, IFiles[0].task,
0, 0xFFFFFFFF, 0, path_binary2);

}
#endif

void Labels_loadLocalSymbols (int taskid, unsigned long nfiles,
struct input_t * IFiles, UINT64 **io_StartingTimes, UINT64 **io_SynchronizationTimes)
{
Expand Down
26 changes: 26 additions & 0 deletions src/merger/paraver/trace_to_prv.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,30 @@ int Paraver_ProcessTraceFiles (unsigned long nfiles,
fset = Create_FS (nfiles, files, taskid, PRV_SEMANTICS);
error = (fset == NULL);

#if defined(OS_RTEMS)
// As there's no support to read XML from RTEMS we need to specify the program name and the destination folder as environment variables
char *prvfile = NULL;
env_program_name = getenv ("EXTRAE_PROGRAM_NAME");
env_final_dir = getenv ("EXTRAE_FINAL_DIR");

prvfile = xmalloc(6 + ((env_final_dir != NULL) ? strlen(env_final_dir) : 1) + ((env_program_name != NULL) ? strlen(env_program_name) : 5)));
sprintf (PATH_NAME, "%s/%s.prv", (env_final_dir != NULL) ? env_final_dir : ".", (env_program_name != NULL) ? env_program_name : "TRACE");

#if defined(HAVE_BFD)
if (!__Extrae_Utils_file_exists(prvfile)){
fprintf (stdout, "mpi2prv: WARNING binary file can not be found at the NFS mounted folder, calltrace info (function names) will be empty \n");
set_option_dump_Addresses(FALSE);
}
#endif

set_merge_OutputTraceName (prvfile);
set_merge_GivenTraceName (TRUE);

if (taskid == 0) Labels_loadRTEMSSymbols(prvfile, files);

xfree(prvfile);
#else

Labels_loadLocalSymbols (taskid, nfiles, files, &StartingTimes, &SynchronizationTimes);

/* If no actual filename is given, use the binary name if possible */
Expand All @@ -249,6 +273,8 @@ int Paraver_ProcessTraceFiles (unsigned long nfiles,
}
}

#endif

if (__Extrae_Utils_file_exists(get_merge_OutputTraceName()) &&
!get_option_merge_TraceOverwrite())
{
Expand Down
2 changes: 1 addition & 1 deletion src/tracer/calltrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ static int ValidAddress (void * Addr) {

#endif /* OS_AIX */

#if defined (OS_SOLARIS)
#if defined (OS_SOLARIS) || defined(OS_RTEMS)
void Extrae_trace_callers (iotimer_t time, int offset, int type)
{
/* TODO */
Expand Down
2 changes: 2 additions & 0 deletions src/tracer/clocks/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ endif
noinst_LTLIBRARIES = libclock.la
libclock_la_SOURCES = $(CLOCKS)
libclock_la_CFLAGS = -I$(CLOCKS_INC) -I$(COMMON_INC) -I$(TRACER_INC)
if !IS_GR740_MACHINE
libclock_la_LDFLAGS = -lrt
endif
4 changes: 3 additions & 1 deletion src/tracer/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
# if defined(FC_FUNC)
# define CtoF77(x) FC_FUNC(x,x)
# else
# error "Error! Not defined FC_FUNC, how do we deal with Fortran symbols?"
# if !defined(OS_RTEMS)
# error "Error! Not defined FC_FUNC, how do we deal with Fortran symbols?"
# endif
# endif

#endif /* HAVE_MPI */
Expand Down
5 changes: 5 additions & 0 deletions src/tracer/hwc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ if HAVE_PMAPI
HWC += common_hwc.c common_hwc.h \
pmapi_hwc.c pmapi_hwc.h
else
if L4STAT
HWC += common_hwc.c common_hwc.h \
l4stat_hwc.c l4stat_hwc.h
else
HWC += fake_hwc.c
endif
endif
endif

noinst_LTLIBRARIES = libhwc.la

Expand Down
Loading