Skip to content

Instantly share code, notes, and snippets.

@secondspass
secondspass / mmtiled_boundary.cpp
Created March 29, 2024 16:02
TIL Corner Turning example code
#include <hip/hip_runtime.h>
#include <hip/nvidia_detail/nvidia_hip_runtime_api.h>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#define gpuErrorCheck(call) \
do { \
hipError_t gpuErr = call; \
if (hipSuccess != gpuErr) { \
@secondspass
secondspass / example.zig
Created July 7, 2023 16:28
printing slice with lldb in zig
const std = @import("std");
pub fn main() !void {
const allocator = std.heap.page_allocator;
var blah: []u8 = try allocator.alloc(u8, 30);
for (blah, 0..) |_, i| {
blah[i] = @intCast(i);
}
}
# See sample output at the bottom of this file
def MPI_Debugging(numSimRuns=1, iterations = 8, batch_size = 1):
#MPI Debugging for testing purposes
#Setup of the communications
comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()
num_agents = size / batch_size
comm2D = comm.Create_cart([num_agents, batch_size])
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <sys/uio.h>
#include <linux/fs.h>
#include <fcntl.h>
#include <unistd.h>
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
int world_rank, world_size, token;
MPI_Init(NULL, NULL);
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
if (world_rank != 0) {
<html>
<head>
<title>Your homepage</title>
<meta http-equiv="refresh" content="0; URL=https://www.secondspass.org">
</head>
<body>
If your browser doesn't automatically go there within a few seconds,
you may want to go to
<a href="https://www.secondspass.org">the destination</a>
manually.
import java.util.*;
class FoodFactory extends Solution {
}
class Food extends Solution {
}
@secondspass
secondspass / example.clj
Created January 18, 2017 09:58
Practice exercise
(def asym-hobbit-body-parts [{:name "head" :size 3}
{:name "left-eye" :size 1}
{:name "left-ear" :size 1}
{:name "mouth" :size 1}
{:name "nose" :size 1}
{:name "neck" :size 2}
{:name "left-shoulder" :size 3}
{:name "left-upper-arm" :size 3}
{:name "chest" :size 10}
{:name "back" :size 10}