Set up a synthetic example, loading some chunked data and exporting it into a Dask array. With this, we can see the task graph.
This file contains hidden or 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
from firedrake import * | |
from firedrake_adjoint import * | |
from firedrake.petsc import PETSc | |
from pyadjoint.tape import pause_annotation | |
mesh = UnitSquareMesh(10, 10) | |
x, y = SpatialCoordinate(mesh) | |
Q = FunctionSpace(mesh, "CG", 2) | |
Y = TestFunction(Q) |
This file contains hidden or 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
import vector | |
class V(vector.Vector): | |
def __init__(self): | |
super().__init__() | |
self.val = 0 | |
def plus(self, x): | |
self.val += x.val | |
This file contains hidden or 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
/* | |
* higher-up library: | |
*/ | |
class Foo { | |
std::shared_ptr<Vector<double>> v; | |
template<class Archive> | |
void serialize(Archive &archive) { | |
// defer polymorphic serialisation of Vector |
This file contains hidden or 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
input=: cutLF fread '~Projects/advent/2020-day2.in' | |
valid=: verb define | |
'con char word'=. ' ' splitstring y | |
'min max'=. ". each '-' splitstring con | |
(min&<: *. <:&max) +/ ({. char) = word | |
) | |
valid2=: verb define |
This file contains hidden or 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
from firedrake import * | |
from firedrake.petsc import PETSc | |
from mpi4py import MPI | |
import math, numpy | |
######################################################################################################### | |
################################## Some important constants etc...: ##################################### | |
######################################################################################################### | |
mesh = UnitSquareMesh(40, 40) # This mesh is generated via a firedrake function |
This file contains hidden or 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 <stdlib.h> | |
void allocate_from_c(double **arr, int *n) { | |
*arr = (double*)malloc(5 * sizeof(double)); | |
*n = 5; | |
double *x = *arr; | |
for (int i = 0; i < *n; i++) { |
This file contains hidden or 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
#version 430 | |
layout(local_size_x = 128, local_size_y = 1) in; | |
layout(std430, binding = 0) buffer input_data { | |
float domain[][128]; | |
}; | |
uniform bool transpose; |
This file contains hidden or 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
import glfw | |
import OpenGL.GL as gl | |
import imgui | |
from imgui.integrations.glfw import GlfwRenderer | |
import cv2 | |
import numpy as np | |
from fluid import Fluid |
This file contains hidden or 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
#lang racket | |
(define in (string-trim (file->string "day15.in"))) | |
(define initial-memory | |
(list->vector | |
(map string->number | |
(string-split in ",")))) | |
(define (step mem inputs ip base) | |
; indirect addressing (with optional offset) |
NewerOlder