Skip to content

Instantly share code, notes, and snippets.

View pavanky's full-sized avatar

Pavan Yalamanchili pavanky

View GitHub Profile
@pavanky
pavanky / isprime.py
Last active August 29, 2015 13:56
Comparing primality tests
#!/usr/bin/python3
def format(f):
return int(f * 100) / 100
def isprime_6k(p):
# Basic Test
if (p % 2 == 0):
return 0,1
@pavanky
pavanky / GTX 690
Created February 24, 2014 22:07
clinfo
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.1 CUDA 4.2.1
Platform Name: NVIDIA CUDA
Platform Vendor: NVIDIA Corporation
Platform Extensions: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll
Platform Name: NVIDIA CUDA
Number of devices: 2
@pavanky
pavanky / Error
Last active August 29, 2015 14:06
clblas_transpose_failure
========================================================
AN INTERNAL KERNEL BUILD ERROR OCCURRED!
device name = Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz
error = -11
memory pattern = Cached global memory based subgroup gemm, computing kernel generator
Subproblem dimensions: dims[0].itemY = 16, dims[0].itemX = 8, dims[0].y = 16, dims[0].x = 8, dims[0].bwidth = 64; ; dims[1].itemY = 4, dims[1].itemX = 4, dims[1].y = 4, dims[1].x = 4, dims[1].bwidth = 8; ;
Parallelism granularity: pgran->wgDim = 2, pgran->wgSize[0] = 8, pgran->wgSize[1] = 8, pgran->wfSize = 64
Kernel extra flags: 939556625
@pavanky
pavanky / cpu_memory.patch
Last active August 29, 2015 14:16
Patch for debugging ArrayFire memory manager
diff --git a/src/backend/cpu/memory.cpp b/src/backend/cpu/memory.cpp
index 1f0ed5b..45481bc 100644
--- a/src/backend/cpu/memory.cpp
+++ b/src/backend/cpu/memory.cpp
@@ -87,6 +87,15 @@ namespace cpu
T* ptr = NULL;
size_t alloc_bytes = divup(sizeof(T) * elements, 1024) * 1024;
+ printf("USED BYTES: %zu MB\n", used_bytes >> 20);
+ printf("NBUFFERS: %zu\n", memory_map.size());
@pavanky
pavanky / moments.cpp
Created March 20, 2015 17:41
Areas and centroids
array areas(const array& in)
{
// Must be 2d image
dim4 dims = in.dims();
array flt_in = flat(in);
// Corner case: no components
array non_zero_ind = where(flt_in != 0);
if (non_zero_ind.isempty())
@pavanky
pavanky / add.cpp
Last active August 29, 2015 14:18
timing arrayfire
#include <iostream>
#include <limits>
#include <arrayfire.h>
using namespace std;
using namespace af;
int comp(const void * elem1, const void * elem2) {
int f = *((int*)elem1);
int s = *((int*)elem2);
@pavanky
pavanky / moving_avg.cpp
Created March 31, 2015 15:45
Moving average with arrayfire
/*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <iostream>
{"log":"May 23 20:36:08 socket\u0009debug\u0009server.lua: we need to do tls, but delaying until send buffer empty\n","stream":"stdout","time":"2015-05-23T20:36:08.67410023Z"}
{"log":"May 23 20:36:08 c2sdeb150\u0009debug\u0009TLS negotiation started for c2s_unauthed...\n","stream":"stdout","time":"2015-05-23T20:36:08.67410023Z"}
{"log":"May 23 20:36:08 socket\u0009debug\u0009server.lua: attempting to start tls on tcp{client}: 0xde84a8\n","stream":"stdout","time":"2015-05-23T20:36:08.67410023Z"}
@pavanky
pavanky / convolve_bench.cpp
Last active August 29, 2015 14:21
ArrayFire convolve2 benchmark
/*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <arrayfire.h>
@pavanky
pavanky / colormap.lua
Created May 28, 2015 19:55
colormap values from arrayfire 2.1
-- grayscale
Colormap.default = {
0 ,0 ,0
,0.0039 ,0.0039 ,0.0039
,0.0078 ,0.0078 ,0.0078
,0.0118 ,0.0118 ,0.0118
,0.0157 ,0.0157 ,0.0157
,0.0196 ,0.0196 ,0.0196
,0.0235 ,0.0235 ,0.0235
,0.0275 ,0.0275 ,0.0275