Skip to content

Instantly share code, notes, and snippets.

View data-panda's full-sized avatar
🏠
WFH

CoderPanda data-panda

🏠
WFH
  • Eindhoven University of Technology
  • Pune
View GitHub Profile
@data-panda
data-panda / error_dither.py
Created April 29, 2021 18:31
Dither Algo with NVTX Markers
def dither(self, img, dither_mask, pixel_loc):
nvtx.range_push("Dithering")
# Determine amount of padding
p = math.ceil(max(dither_mask.shape)/2)
# print("Padding with: ",p)
# Pad image (same amount in all directions, can be more efficient, but easy for now)
out = Func.pad(img, (p,p,p,p), "replicate")
# mini-batch size, channels, heigth, width
F, C, H, W = out.size()
m,n = dither_mask.shape
/* minimal code example showing how to call the zfp (de)compressor */
#ifdef DOUBLE_DT
typedef double md;
#else
typedef float md;
#endif
#include <math.h>
#include <stdio.h>
@data-panda
data-panda / omp_768_cr_2.c
Last active February 10, 2021 17:55
Open mp compression and serial decompression
/* minimal code example showing how to call the zfp (de)compressor */
#ifdef DOUBLE_DT
typedef double md;
#else
typedef float md;
#endif
#include <math.h>
#include <stdio.h>
@data-panda
data-panda / simple_0bug_reproducer.c
Last active February 10, 2021 14:21
Zero bug reproducer for cuda zfp
/* minimal code example showing how to call the zfp (de)compressor */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <zfp.h>
/* fill grid with a floating point value */
static inline void
@data-panda
data-panda / tpl.c
Created April 19, 2018 16:13
Tripple_Pointer_Legacy
typedef double lr;
lr ***lr_3D_matrix(int m, int n, int o)/** \brief create a 3D matrix with size [m, n,o] of type lr*/
{
lr ***matrix;
int i, j;
matrix = malloc(m * sizeof(lr **)); //allocate first dimension
matrix[0] = malloc(m * n * sizeof(lr *)); //allocate continous memory block for all elements
matrix[0][0] = malloc(m * n * o * sizeof(lr)); //allocate memory for the whole matrix