Skip to content

Commit

Permalink
Init repo with last HG state
Browse files Browse the repository at this point in the history
  • Loading branch information
moebiusband73 committed May 20, 2014
0 parents commit 253a35d
Show file tree
Hide file tree
Showing 645 changed files with 155,919 additions and 0 deletions.
622 changes: 622 additions & 0 deletions COPYING

Large diffs are not rendered by default.

109 changes: 109 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
== Basic build ==

1. Edit config.mk. Follow the comments there.
Optionally you can change compiler settings in include_[GCC|ICC].mk.
Please note that only the default compiler flags are supported and tested.
2. make
(2.a make likwid-bench (if you want to build and install likwid-bench)
3. make install (this is required for likwid-pin and if you use the accessDaemon)
4. setup access to the msr device files (see end of this document)

Only the default flags set are tested. As it is not possible to test all
compiler setting variants the Intel icc compiler is only build tested. A basic
function test is done for the icc binary. The only variant fully tested is gcc
with default compiler flags. It is therefore recommended to use gcc with the
default flags. If you want to use and build the Fortran interface you can mix
GCC with the Intel Fortran Compiler. More information on this can be found in
the WIKI.

*NOTICE*

All generated files are located in the [GCC|ICC] build directory.
This includes the dependency files, object files and also the
generated source files and the pas and assembly files for likwid-bench.
If you debug your likwid-bench benchmarks you can look at all
intermediate build files and also the final assembly code.

== Known problems ==

On very old systems with old kernels (< 2.6.7) or old glibc versions likwid
is build with reduced funtionality. This includes missing support for NUMA
and pinning.

== Additional Targets ==

make clean - clean the object directory
make distclean - clean also the executables/libraries
make uninstall - delete installed files

== Build likwid-bench ==

To build likwid-bench you have to explicitly call:

make likwid-bench

This is because likwid-bench does not compile on 32bit systems.

== Build accessDaemon ==

To build the accessDaemon:

1. Edit config.mk and configure path in ACCESSDAEMON variable.
2. Set the desired default ACCESSMODE. You can overwrite this on the command line.
2. make will also build the accessDaemon
3. Install with
make install

With the standard make install target the daemon will also be installed in
${PREFIX}/bin . Don't forget to copy the dameon if you configured a different
path in ACCESSDAEMON.

== Setup of msr module ==

likwid-perfctr, likwid-powermeter and likwid-features require the Linux msr kernel module. This module
is part of most standard distro kernels. You have to be root to do the initial setup.

1. Check if the msr module is loaded with 'lsmod | grep msr' . There should be an output.
2. It the module is not loaded load it with 'modprobe msr' . For automatic loading at startup
consult your distros documentation how to do so.
3. Adopt access rights on the msr device files for normal user. To allow everybody access you can
use 'chmod o+rw /dev/cpu/*/msr' . This is only recommended on save single user desktop systems.

As a general access to the msr registers is not desired on security sensitive
systems you can either implement a more sophisticated access rights settings
with e.g. setgid. A common solution used on many other device files, e.g. for
audio, is to introduce a group and make a chown on the msr device files to that
group. Now if you execute likwid-perfctr with setgid on that group the
executing user can use the tool but cannot directly write or read the msr
device files.

A secure solution is to use the accessDaemon, which encapsulates the access to
the msr device files and performs a address check for allowed registers. For
more information how to setup and use this solution have a look at the WIKI
page:

http://code.google.com/p/likwid/wiki/MSRDaemon

A demo for a root exploit involving the msr device files was published. As
a consequence the security settings for access to the msr device files are
tightened in recent kernels.

Just setting the file access rights or using suid root on the access daemon is
not sufficient anymore. You have to register your binary now to get access.
This is only necessary if above setup dos not work.

You register the necessary capability by calling

sudo setcap cap_sys_rawio+ep EXECUTABLE

on the executables. This is only possible on local file systems.
The only feasable way is to register the likwid-accessD and proxy all access over it.

If you have still problems please let me know on the likwid mailing list:

http://groups.google.com/group/likwid-users





242 changes: 242 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
# =======================================================================================
#
# Filename: Makefile
#
# Description: Central Makefile
#
# Version: <VERSION>
# Released: <DATE>
#
# Author: Jan Treibig (jt), [email protected]
# Project: likwid
#
# Copyright (C) 2013 Jan Treibig
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# =======================================================================================

SRC_DIR = ./src
DOC_DIR = ./doc
GROUP_DIR = ./groups
FILTER_DIR = ./filters
MAKE_DIR = ./make
EXT_TARGETS = ./ext/lua ./ext/hwloc ./src/libwid

#DO NOT EDIT BELOW


# Dependency chains:
# *.[ch] -> *.o -> executables
# *.ptt -> *.pas -> *.s -> *.o -> executables
# *.txt -> *.h (generated)

include ./config.mk
include $(MAKE_DIR)/include_$(COMPILER).mk
include $(MAKE_DIR)/config_checks.mk
include $(MAKE_DIR)/config_defines.mk

INCLUDES += -I./src/includes -I./ext/lua/includes -I./ext/hwloc/include -I$(BUILD_DIR)
LIBS +=

#CONFIGURE BUILD SYSTEM
BUILD_DIR = ./$(COMPILER)
Q ?= @
GENGROUPLOCK = .gengroup

ifeq ($(COMPILER),MIC)
BENCH_DIR = ./bench/phi
else
ifeq ($(COMPILER),GCCX86)
BENCH_DIR = ./bench/x86
else
BENCH_DIR = ./bench/x86-64
endif
endif

ifeq ($(SHARED_LIBRARY),true)
CFLAGS += $(SHARED_CFLAGS)
LIBS += -L. -llikwid -lm
DYNAMIC_TARGET_LIB := liblikwid.so
TARGET_LIB := $(DYNAMIC_TARGET_LIB)
else
STATIC_TARGET_LIB := liblikwid.a
TARGET_LIB := $(STATIC_TARGET_LIB)
endif


VPATH = $(SRC_DIR)
OBJ = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c))
OBJ += $(patsubst $(SRC_DIR)/%.cc, $(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.cc))
PERFMONHEADERS = $(patsubst $(SRC_DIR)/includes/%.txt, $(BUILD_DIR)/%.h,$(wildcard $(SRC_DIR)/includes/*.txt))
OBJ_BENCH = $(patsubst $(BENCH_DIR)/%.ptt, $(BUILD_DIR)/%.o,$(wildcard $(BENCH_DIR)/*.ptt))
OBJ_LUA = $(wildcard ./ext/lua/$(COMPILER)/*.o)
OBJ_HWLOC = $(wildcard ./ext/hwloc/$(COMPILER)/*.o)
OBJ_LIBWID = $(wildcard ./src/libwid/$(COMPILER)/*.o)

APPS = likwid-perfctr \
likwid-features \
likwid-powermeter \
likwid-memsweeper \
likwid-topology \
likwid-genCfg \
likwid-pin \
likwid-bench

LIBWID = libwid.a
LIBHWLOC = ext/hwloc/libhwloc.a

CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(INCLUDES)

all: $(BUILD_DIR) $(GENGROUPLOCK) $(PERFMONHEADERS) $(OBJ) $(OBJ_BENCH) $(EXT_TARGETS) $(STATIC_TARGET_LIB) $(DYNAMIC_TARGET_LIB) $(APPS) $(FORTRAN_INTERFACE) $(PINLIB) $(DAEMON_TARGET)

tags:
@echo "===> GENERATE TAGS"
$(Q)ctags -R

$(APPS): $(addprefix $(SRC_DIR)/applications/,$(addsuffix .c,$(APPS))) $(BUILD_DIR) $(GENGROUPLOCK) $(OBJ) $(OBJ_BENCH)
@echo "===> LINKING $@"
$(Q)${CC} $(CFLAGS) $(ANSI_CFLAGS) $(CPPFLAGS) ${LFLAGS} -o $@ $(addprefix $(SRC_DIR)/applications/,$(addsuffix .c,$@)) $(OBJ_BENCH) $(TARGET_LIB) $(LIBHWLOC) $(LIBS)

$(STATIC_TARGET_LIB): $(OBJ)
@echo "===> CREATE STATIC LIB $(STATIC_TARGET_LIB)"
$(Q)${AR} -cq $(STATIC_TARGET_LIB) $(OBJ) $(OBJ_HWLOC)

$(LIBWID): $(OBJ_LUA) $(OBJ_HWLOC) $(OBJ_LIBWID)
@echo "===> CREATE STATIC LIB $(LIBWID)"
$(Q)${AR} -cq $(LIBWID) $(OBJ_LUA) $(OBJ_HWLOC) $(OBJ_LIBWID)


$(DYNAMIC_TARGET_LIB): $(OBJ)
@echo "===> CREATE SHARED LIB $(DYNAMIC_TARGET_LIB)"
$(Q)${CC} $(SHARED_LFLAGS) $(SHARED_CFLAGS) -o $(DYNAMIC_TARGET_LIB) $(OBJ) $(OBJ_HWLOC)

$(DAEMON_TARGET): $(SRC_DIR)/access-daemon/accessDaemon.c
@echo "===> Build access daemon likwid-accessD"
$(Q)$(MAKE) -C $(SRC_DIR)/access-daemon

$(BUILD_DIR):
@mkdir $(BUILD_DIR)

$(PINLIB):
@echo "===> CREATE LIB $(PINLIB)"
$(Q)$(MAKE) -s -C src/pthread-overload/ $(PINLIB)

$(GENGROUPLOCK): $(foreach directory,$(shell ls $(GROUP_DIR)), $(wildcard $(GROUP_DIR)/$(directory)/*.txt))
@echo "===> GENERATE GROUP HEADERS"
$(Q)$(GEN_GROUPS) ./groups $(BUILD_DIR) ./perl/templates
$(Q)touch $(GENGROUPLOCK)

$(FORTRAN_INTERFACE): $(SRC_DIR)/likwid.f90
@echo "===> COMPILE FORTRAN INTERFACE $@"
$(Q)$(FC) -c $(FCFLAGS) $<
@rm -f likwid.o

$(EXT_TARGETS):
@echo "===> ENTER $@"
$(Q)$(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS)

#PATTERN RULES
$(BUILD_DIR)/%.o: %.c
@echo "===> COMPILE $@"
$(Q)$(CC) -c $(CFLAGS) $(ANSI_CFLAGS) $(CPPFLAGS) $< -o $@
$(Q)$(CC) $(CPPFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d

$(BUILD_DIR)/%.o: %.cc
@echo "===> COMPILE $@"
$(Q)$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@
$(Q)$(CXX) $(CXXFLAGS) $(CPPFLAGS) -MT $(@:.d=.o) -MM $< > $(BUILD_DIR)/$*.d


$(BUILD_DIR)/%.pas: $(BENCH_DIR)/%.ptt
@echo "===> GENERATE BENCHMARKS"
$(Q)$(GEN_PAS) $(BENCH_DIR) $(BUILD_DIR) ./perl/templates

$(BUILD_DIR)/%.h: $(SRC_DIR)/includes/%.txt
@echo "===> GENERATE HEADER $@"
$(Q)$(GEN_PMHEADER) $< $@

$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.pas
@echo "===> ASSEMBLE $@"
$(Q)$(PAS) -i $(PASFLAGS) -o $(BUILD_DIR)/$*.s $< '$(DEFINES)'
$(Q)$(AS) $(ASFLAGS) $(BUILD_DIR)/$*.s -o $@

ifeq ($(findstring $(MAKECMDGOALS),clean),)
-include $(OBJ:.o=.d)
endif

.PHONY: clean distclean install uninstall $(EXT_TARGETS)


.PRECIOUS: $(BUILD_DIR)/%.pas

.NOTPARALLEL:


clean: $(EXT_TARGETS)
@echo "===> CLEAN"
@rm -rf $(BUILD_DIR)
@rm -f $(GENGROUPLOCK)

distclean: clean
@echo "===> DIST CLEAN"
@rm -f likwid-*
@rm -f $(STATIC_TARGET_LIB)
@rm -f $(DYNAMIC_TARGET_LIB)
@rm -f $(FORTRAN_INTERFACE)
@rm -f $(PINLIB)
@rm -f tags

install:
@echo "===> INSTALL applications to $(PREFIX)/bin"
@mkdir -p $(PREFIX)/bin
@cp -f likwid-* $(PREFIX)/bin
@cp -f perl/feedGnuplot $(PREFIX)/bin
@cp -f perl/likwid-* $(PREFIX)/bin
@chmod 755 $(PREFIX)/bin/likwid-*
@echo "===> INSTALL man pages to $(MANPREFIX)/man1"
@mkdir -p $(MANPREFIX)/man1
@sed -e "s/<VERSION>/$(VERSION)/g" -e "s/<DATE>/$(DATE)/g" < $(DOC_DIR)/likwid-topology.1 > $(MANPREFIX)/man1/likwid-topology.1
@sed -e "s/<VERSION>/$(VERSION)/g" -e "s/<DATE>/$(DATE)/g" < $(DOC_DIR)/likwid-features.1 > $(MANPREFIX)/man1/likwid-features.1
@sed -e "s/<VERSION>/$(VERSION)/g" -e "s/<DATE>/$(DATE)/g" < $(DOC_DIR)/likwid-perfctr.1 > $(MANPREFIX)/man1/likwid-perfctr.1
@sed -e "s/<VERSION>/$(VERSION)/g" -e "s/<DATE>/$(DATE)/g" < $(DOC_DIR)/likwid-powermeter.1 > $(MANPREFIX)/man1/likwid-powermeter.1
@sed -e "s/<VERSION>/$(VERSION)/g" -e "s/<DATE>/$(DATE)/g" < $(DOC_DIR)/likwid-pin.1 > $(MANPREFIX)/man1/likwid-pin.1
@chmod 644 $(MANPREFIX)/man1/likwid-*
@echo "===> INSTALL headers to $(PREFIX)/include"
@mkdir -p $(PREFIX)/include
@cp -f src/includes/likwid*.h $(PREFIX)/include/
$(FORTRAN_INSTALL)
@echo "===> INSTALL libraries to $(PREFIX)/lib"
@mkdir -p $(PREFIX)/lib
@cp -f liblikwid* $(PREFIX)/lib
@chmod 755 $(PREFIX)/lib/$(PINLIB)
@echo "===> INSTALL filters to $(LIKWIDFILTERPATH)"
@mkdir -p $(LIKWIDFILTERPATH)
@cp -f filters/* $(LIKWIDFILTERPATH)
@chmod 755 $(LIKWIDFILTERPATH)/*

uninstall:
@echo "===> REMOVING applications from $(PREFIX)/bin"
@rm -f $(addprefix $(PREFIX)/bin/,$(APPS))
@rm -f $(PREFIX)/bin/likwid-mpirun
@rm -f $(PREFIX)/bin/likwid-perfscope
@rm -f $(PREFIX)/bin/feedGnuplot
@echo "===> REMOVING man pages from $(MANPREFIX)/man1"
@rm -f $(addprefix $(MANPREFIX)/man1/,$(addsuffix .1,$(APPS)))
@echo "===> REMOVING libs from $(PREFIX)/lib"
@rm -f $(PREFIX)/lib/liblikwid*
@echo "===> REMOVING filter from $(PREFIX)/share"
@rm -rf $(PREFIX)/share/likwid



27 changes: 27 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Likwid is a simple to install and use toolsuite of command line applications
for performance oriented programmers. It works for Intel and AMD processors
on the Linux operating system.

It consists of:

likwid-topology - print thread and cache topology
likwid-features - view and toggle feature reagister on Intel processors
likwid-perfctr - configure and read out hardware performance counters on Intel and AMD processors
likwid-powermeter - read out RAPL Energy information and get info about Turbo Mode steps
likwid-pin - pin your threaded application (pthread, Intel and gcc OpenMP to dedicated processors
likwid-bench - Micro benchmarking platform
likwid-gencfg - Dumps topology information to a file
likwid-mpirun - Wrapper to start MPI and Hybrid MPI/OpenMP applications (Supports Intel MPI and OpenMPI)
likwid-scope - Frontend to the timeline mode of likwid-perfctr, plots live graphs of performance metrics

For a detailed documentation on the usage of the tools have a look at the
likwid wiki pages at:

http://code.google.com/p/likwid/wiki/Introduction

If you have problems or suggestions please let me know on the likwid mailing list:

http://groups.google.com/group/likwid-users



13 changes: 13 additions & 0 deletions bench/phi/copy.ptt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
STREAMS 2
TYPE DOUBLE
FLOPS 0
BYTES 16
LOOP 32
vmovaps zmm0, [STR0 + GPR1 * 8]
vmovaps zmm1, [STR0 + GPR1 * 8 + 64]
vmovaps zmm2, [STR0 + GPR1 * 8 + 128]
vmovaps zmm3, [STR0 + GPR1 * 8 + 192]
vmovaps [STR1 + GPR1 * 8] , zmm0
vmovaps [STR1 + GPR1 * 8 + 64], zmm1
vmovaps [STR1 + GPR1 * 8 + 128], zmm2
vmovaps [STR1 + GPR1 * 8 + 192], zmm3
Loading

0 comments on commit 253a35d

Please sign in to comment.