Skip to content

Instantly share code, notes, and snippets.

View mikejs's full-sized avatar

Michael Stephens mikejs

View GitHub Profile
Index: lib/clyther/tests/test_integer_ops.py
===================================================================
--- lib/clyther/tests/test_integer_ops.py (revision 71)
+++ lib/clyther/tests/test_integer_ops.py (working copy)
@@ -178,6 +178,22 @@
_test_unary_minus.func(a, output)
self.failUnlessEqual(clout.item(), output[0])
+
+ def test_mod(self):
// === === === === === === ===
//CLyther Module
struct _array_desc_ {
size_t start[3];
size_t stop[3];
size_t step[3];
size_t shape[3];
size_t size;
};
Index: lib/clyther/api/ast/astgen.py
===================================================================
--- lib/clyther/api/ast/astgen.py (revision 68)
+++ lib/clyther/api/ast/astgen.py (working copy)
@@ -584,6 +584,14 @@
return ast.Bitor( cl_nodes, node.lineno ), nd_type
+ def visitBitxor(self,node):
+ nd, nd_type = self.dispatch(node.nodes[0])
import clyther
import copencl as cl
@clyther.kernel
def broken(a):
b = a << 2
c = a >> 2
if __name__ == '__main__':
clyther.init('GPU')
#!/usr/bin/env python
from __future__ import division
import nltk
nltk.data.path.append('/Users/mike/.nltk_data')
inaugural = nltk.corpus.inaugural
with open('./sentence_lengths.csv', 'w') as out:
for fileid in inaugural.fileids():
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <OpenCL/opencl.h>
const char *KernelSource = "\n" \
"#define DELTA 0x9e3779b9 \n" \
"#define ENC_ROUND(sum)" \
"{ " \
import sys
import mapnik2
import cairo
prj = mapnik2.Projection("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
m = mapnik2.Map(1280, 768, prj.params())
m.background = mapnik2.Color('white')
district_lyr = mapnik2.Layer('Districts')
district_lyr.datasource = mapnik2.PostGIS(
import sys
import mapnik2
import cairo
prj = mapnik2.Projection("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
m = mapnik2.Map(1280, 768, prj.params())
m.background = mapnik2.Color('white')
district_lyr = mapnik2.Layer('Districts')
district_lyr.datasource = mapnik2.PostGIS(
# -*- mode: python; -*-
def exampleCheck(context):
context.Message('Custom check...')
return context.Result(True)
env = Environment()
conf = Configure(env, custom_tests={'ExampleCheck': exampleCheck})
# Always prints 'Custom check...(cached)', even when not cached
#!/usr/bin/env python
import logging
import pymongo
import datetime
class MongoHandler(logging.Handler):
"""
A logging handler that will record messages to a (optionally capped)
MongoDB collection.