Skip to content

Instantly share code, notes, and snippets.

@dubik
dubik / len.cu
Last active March 26, 2018 08:29
const int N_VECTORS = 1<<20;
const int VECTOR_COMPONENTS = 512;
const int KBlockSize = 256;
__global__
void calculateDistances(const float v[VECTOR_COMPONENTS], float *vectors, float *distances)
{
int vectorIndex = threadIdx.x + threadIdx.y * KBlockSize;
if (vectorIndex < N_VECTORS) {
float *vector = vectors + vectorIndex * VECTOR_COMPONENTS;
// CacheSmth.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <chrono>
#include <iostream>
struct Timer
{
Timer()