Skip to content

Instantly share code, notes, and snippets.

View omaralvarez's full-sized avatar
🎯
Focusing

Omar Alvarez omaralvarez

🎯
Focusing
View GitHub Profile
@omaralvarez
omaralvarez / print_progress.py
Created January 4, 2017 18:29 — forked from aubricus/License
Python Progress Bar
# -*- coding: utf-8 -*-
# Print iterations progress
def print_progress(iteration, total, prefix='', suffix='', decimals=1, bar_length=100):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
@omaralvarez
omaralvarez / sm_bfs.cu
Last active July 13, 2016 18:34
BFS Search Block Queues
// Block queuing stub
__global__ void gpu_block_queuing_kernel(
int *nodePtrs, int *nodeNeighbors, int *nodeVisited,
int *currLevelNodes, int *nextLevelNodes,
const unsigned int numCurrLevelNodes, int *numNextLevelNodes) {
//@@ INSERT Block Queuing code here
// Initialize shared memory queue
__shared__ int block_queue[BQ_CAPACITY];
@omaralvarez
omaralvarez / sm_gather.cu
Last active July 12, 2016 07:12
Shared Memory Gather
__global__ void s2g_sm_gpu_gather_kernel(int *in, int *out, int len) {
//@@ INSERT CODE HERE
__shared__ int values[TILE_SIZE];
// Get our global thread ID
int id = blockIdx.x*blockDim.x + threadIdx.x;
int sum = 0;