Skip to content

Instantly share code, notes, and snippets.

View FabioLuporini's full-sized avatar

Fabio Luporini FabioLuporini

  • Devito Codes
View GitHub Profile
#include <stdio.h>
#include "stdlib.h"
#include "math.h"
#include "sys/time.h"
#include "omp.h"
/*
* clear
* aompcc -O3 -g -fPIC -Wall -Wno-unused-result -Wno-unused-variable -ffast-math omp_off_leak_mfe.c -o omp_off_leak_mfe
* ./omp_off_leak_mfe
#include <stdio.h>
#include "stdlib.h"
#include "math.h"
#include "sys/time.h"
#include "omp.h"
/*
* clear
* aompcc -O3 -g -fPIC -Wall -Wno-unused-result -Wno-unused-variable -ffast-math omp_off_leak_mfe.c -o omp_off_leak_mfe
* ./omp_off_leak_mfe
import numpy as np
from devito import * # noqa
from examples.seismic import TimeAxis, RickerSource, Receiver
shape = (101, 101)
extent = (1000, 1000)
origin = (0., 0.)
v = np.empty(shape, dtype=np.float32)
v[:, :51] = 1.5
@FabioLuporini
FabioLuporini / gist:9916207da479665a44b7751fa01516f6
Created January 4, 2021 14:09
Clang+OpeMP offloading leak?
/* Compile and run with
clang -O3 -g -fPIC -Wall -Wno-unused-result -Wno-unused-variable -ffast-math -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda mfe.c -o mfe ; ./mfe
*/
#include "omp.h"
#include <stdio.h>
int main(int argc, char* argv[])
@FabioLuporini
FabioLuporini / clang11-offloading-mfe.c
Last active November 23, 2020 09:21
Reproducer for odd clang11 offloading failure
#include "omp.h"
#include <stdio.h>
int main(int argc, char* argv[])
{
int t_size = 1;
int x_size = 4;
int y_size = 4;
int z_size = 4;
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Time Dependent Born\n",
"\n",
"Here we code the propagation time extension Born operators."
]
@FabioLuporini
FabioLuporini / openacc_mpi.c
Created April 1, 2020 13:05
openacc+mpi breaking example
#define _POSIX_C_SOURCE 200809L
#include "stdlib.h"
#include "math.h"
#include "sys/time.h"
#include "mpi.h"
#include "openacc.h"
struct dataobj
{
void *restrict data;
@FabioLuporini
FabioLuporini / gist:1a7f8b2982ea95a9dd35c3166a260996
Created February 27, 2019 10:18
install mpi4py with intel toolchain
# First, make sure icc/mpiicc are in PATH, typically via sourcing :
source /opt/intel/bin/compilervars.sh intel64
# Then :
export CC=icc
export MPICC=mpiicc
pip install mpi4py
@FabioLuporini
FabioLuporini / comparison.txt
Last active March 22, 2018 09:27
master vs domain-allocation switch
RUNTIME COMPARISON
------------------
conclusions: master matches domain-allocation switch in both ``core`` and ``yask`` (no slowdowns, no speedups)
reports below for acoustic SO=4 and tti SO=4 with max opt level, openmp, pinning etc
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# *domain-allocation switch*: acoustic, core, max opt level
@FabioLuporini
FabioLuporini / csre-impact.c
Created July 15, 2017 16:29
CSRE impact in TTI
for (int x = x_start, xs0 = x + x_ub0; x < x_finish; x += 1, xs0 = xs0 + 1)
{
for (int y = y_start, ys0 = y + y_ub0; y < y_finish; y += 1, ys0 = ys0 + 1)
{
#pragma ivdep
#pragma omp simd
for (int z = z_start; z < z_finish; z += 1)
{
float s0 = 1.0e-1F*v[t0][xs0][ys0 - 1][z] - 7.5e-2F*v[t0][xs0][ys0 - 1][z - 1] - 2.5e-2F*v[t0][xs0][ys0 - 1][z + 1];
float s1 = 2.5e-2F*(-v[t0][xs0 - 1][ys0 - 1][z - 1] + v[t0][xs0 + 1][ys0 - 1][z - 1]);