This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Python 3 changes hash seeds upon interpreter start. | |
# https://docs.python.org/3/reference/datamodel.html#object.__hash__ | |
# | |
# This was to fix the following vulnerability: | |
# http://ocert.org/advisories/ocert-2011-003.html | |
# | |
# For non-web apps, the hash non-determinism between interpreter runs | |
# can be fixed by setting an env var: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Floating Point 4x4 Matrix Multiplication */ | |
.global _start | |
_start: | |
LDR R0, =matrix0 | |
LDR R1, =matrix1 | |
LDR R2, =matrix2 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DisjointForest: | |
class Subset: | |
def __init__(self, elem, parent=None, rank=0): | |
self.elem = elem | |
self.parent = parent | |
self.rank = rank | |
def __repr__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <chrono> | |
#include <cmath> | |
#include <future> | |
#include <iostream> | |
#include <memory> | |
#include <mutex> | |
#include <thread> | |
template<typename Ret, typename Fun, typename Arg> | |
class ReusableWorkerThreadWithFuture { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <unistd.h> | |
#include <iostream> | |
#include <nvml.h> | |
#define cudaSafeCall(call) \ | |
do { \ | |
cudaError_t err = call; \ | |
if (cudaSuccess != err) { \ | |
fprintf (stderr, "Cuda error in file '%s' in line %i : %s.", \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: The network here is not means to make any sense. It's just for measuring perf impact. | |
import torch | |
import torch.nn.functional as F | |
from time import time | |
class Net(torch.nn.Module): | |
def __init__(self): | |
super(Net, self).__init__() | |
fcs = [torch.nn.Linear(10, 100)] + [torch.nn.Linear(100, 100) for _ in range(20)] | |
self.fcs = torch.nn.Sequential(*fcs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <thread> | |
#include <chrono> | |
#include <iostream> | |
const int N = 1 << 20; | |
__global__ void kernel(float *x, int n) | |
{ | |
int tid = threadIdx.x + blockIdx.x * blockDim.x; |
NewerOlder