Add OmpSs-2 simple example
This commit is contained in:
2
ompss2/.gitignore
vendored
Normal file
2
ompss2/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
hello
|
||||
ovni/
|
||||
13
ompss2/Makefile
Normal file
13
ompss2/Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
CC=clang
|
||||
CFLAGS=-fompss-2
|
||||
|
||||
hello: hello.c
|
||||
|
||||
trace: hello
|
||||
rm -rf ovni/
|
||||
NOSV_CONFIG_OVERRIDE="instrumentation.version=ovni" NOSV_APPID=1 ./hello
|
||||
ovniemu ovni/
|
||||
ls -l ovni/*.prv
|
||||
|
||||
clean:
|
||||
rm -rf hello ovni/
|
||||
57
ompss2/README.md
Normal file
57
ompss2/README.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# OmpSs-2 environment
|
||||
|
||||
This example shows how to include the LLVM compiler to build OmpSs-2 programs
|
||||
with the new NODES and nOS-V runtime. The package `clangOmpss2Nodes` already
|
||||
sets all the needed variables to locate the right runtime.
|
||||
|
||||
Run `nix develop` then `make` to build the `hello` program:
|
||||
|
||||
apex% nix develop
|
||||
apex$ make
|
||||
clang -fompss-2 hello.c -o hello
|
||||
apex$ ./hello
|
||||
hello from task 1
|
||||
hello from task 0
|
||||
hello from task 2
|
||||
hello from task 3
|
||||
hello from task 4
|
||||
hello from task 7
|
||||
hello from task 8
|
||||
hello from task 6
|
||||
hello from task 9
|
||||
hello from task 5
|
||||
|
||||
You can use `make trace` to run the hello program with instrumentation and
|
||||
generate an ovni trace that is then converted to paraver:
|
||||
|
||||
apex$ make trace
|
||||
rm -rf ovni/
|
||||
NOSV_CONFIG_OVERRIDE="instrumentation.version=ovni" NOSV_APPID=1 ./hello
|
||||
hello from task 1
|
||||
hello from task 0
|
||||
hello from task 3
|
||||
hello from task 4
|
||||
hello from task 5
|
||||
hello from task 6
|
||||
hello from task 2
|
||||
hello from task 8
|
||||
hello from task 7
|
||||
hello from task 9
|
||||
ovniemu ovni/
|
||||
ovniemu: INFO: loaded 58 streams
|
||||
ovniemu: INFO: sorting looms by name
|
||||
ovniemu: INFO: loaded 1 looms, 1 processes, 58 threads and 56 cpus
|
||||
ovniemu: INFO: generated with libovni version 1.13.0 commit 0643266
|
||||
ovniemu: INFO: the following 2 models are enabled:
|
||||
ovniemu: INFO: ovni 1.1.0 'O' (18 events)
|
||||
ovniemu: INFO: nosv 2.6.0 'V' (64 events)
|
||||
ovniemu: INFO: emulation starts
|
||||
ovniemu: INFO: apex.nosv-u1880-p598308 burst stats: median/avg/max = 77/ 81/333 ns
|
||||
ovniemu: WARN: ignoring old event OCn
|
||||
ovniemu: INFO: 100.0% done at avg 42 kev/s
|
||||
ovniemu: INFO: processed 711 input events in 0.02 s
|
||||
ovniemu: INFO: writing traces to disk, please wait
|
||||
ovniemu: INFO: emulation finished ok
|
||||
ls -l ovni/*.prv
|
||||
-rw-r--r-- 1 rarias Computational 48224 Feb 4 11:52 ovni/cpu.prv
|
||||
-rw-r--r-- 1 rarias Computational 33689 Feb 4 11:52 ovni/thread.prv
|
||||
45
ompss2/flake.lock
generated
Normal file
45
ompss2/flake.lock
generated
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"nodes": {
|
||||
"jungle": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770128250,
|
||||
"narHash": "sha256-Kx3EwImhYCp4bLPNWGz4oL4IYVjkCLXwcVmXTY40MBc=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "7a6e4232de0e181de97e099e600ffc3a964260e0",
|
||||
"revCount": 1536,
|
||||
"type": "git",
|
||||
"url": "https://jungle.bsc.es/git/rarias/jungle"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://jungle.bsc.es/git/rarias/jungle"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1767634882,
|
||||
"narHash": "sha256-2GffSfQxe3sedHzK+sTKlYo/NTIAGzbFCIsNMUPAAnk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3c9db02515ef1d9b6b709fc60ba9a540957f661c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-25.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"jungle": "jungle"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
36
ompss2/flake.nix
Normal file
36
ompss2/flake.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
inputs.jungle.url = "git+https://jungle.bsc.es/git/rarias/jungle";
|
||||
outputs = { self, jungle }:
|
||||
let
|
||||
nixpkgs = jungle.inputs.nixpkgs;
|
||||
customOverlay = (final: prev: {
|
||||
# Example overlay, for now empty
|
||||
});
|
||||
pkgs = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
overlays = [
|
||||
# Apply jungle overlay to get our BSC custom packages
|
||||
jungle.outputs.bscOverlay
|
||||
# And on top apply our local changes to customize for cluster
|
||||
customOverlay
|
||||
];
|
||||
};
|
||||
in {
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
pname = "ompss2-devshell";
|
||||
# Include these packages in the shell
|
||||
packages = with pkgs; [
|
||||
clangOmpss2Nodes
|
||||
nodes
|
||||
nosv
|
||||
ovni
|
||||
# Optional: Add wxparaver to open .prv traces (needs a working $DISPLAY)
|
||||
# wxparaver
|
||||
];
|
||||
# The dependencies needed to build these packages will be also included
|
||||
inputsFrom = with pkgs; [
|
||||
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
10
ompss2/hello.c
Normal file
10
ompss2/hello.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
for (int i = 0; i < 10; i++) {
|
||||
#pragma oss task
|
||||
printf("hello from task %d\n", i);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user