A metatable can be defined like
local t = setmetatable({}, {
__tostring = function() return 'custom tostring behavior!' end
})
Here are the metamethods that you can define, and their behavior
using Distributed | |
addprocs(2) | |
println(workers()) | |
@everywhere using Distributed | |
@everywhere function remote_worker(fn, entries, results) | |
while true | |
# take data from remote channel asynchronously |
#!/bin/bash | |
# Redirect LD_DEBUG output (stderr) to ts (from moreutils https://github.com/madx/moreutils/blob/master/ts) | |
# Every process gets it's own file (ld_trace.<pid>.log) | |
LD_DEBUG=all "$@" 2> >(ts '%Y-%m-%d %H:%M:%.S' >ld_trace.$$.log) |
-- split a string | |
function string:split(delimiter) | |
local result = { } | |
local from = 1 | |
local delim_from, delim_to = string.find( self, delimiter, from ) | |
while delim_from do | |
table.insert( result, string.sub( self, from , delim_from-1 ) ) | |
from = delim_to + 1 | |
delim_from, delim_to = string.find( self, delimiter, from ) | |
end |
module memtar | |
using Tar, CodecZlib, TranscodingStreams | |
mutable struct InMemoryFile | |
size::Int | |
pos::Int | |
str::Union{Nothing, String} | |
end |
#!/usr/bin/env python | |
""" | |
Demo of how to pass GPU memory managed by pycuda to mpi4py. | |
Notes | |
----- | |
This code can be used to perform peer-to-peer communication of data via | |
NVIDIA's GPUDirect technology if mpi4py has been built against a | |
CUDA-enabled MPI implementation. |
# | |
# AMReX Make configuration for Homebrew | |
# | |
# If it exists, the Make.local file is included at the end of Make.defs. Thus | |
# one can override various variables here. | |
# | |
# Do not check this file into git repo. This is supposed to be purely local. | |
# | |
#include <new> | |
#include <vector> | |
#include <iostream> | |
#pragma omp declare target | |
// polymorphic Abstract Base Class | |
class Base { | |
public: | |
virtual double doOne(double x) = 0; // do something interesting | |
virtual Base* getDevPtr() = 0; // get a device pointer to device shadow instance of class |
I hereby claim:
To claim this, I am signing this object: