Skip to content

Instantly share code, notes, and snippets.

View griwes's full-sized avatar

Michał Dominiak griwes

View GitHub Profile

We don't really have docs at this point in time, just getting the lib out of the door was quite the chunk of work; but all the things we expose follow the ISO C++ standard, and its standard library, and cppreference is a good source of documentation for that. In CUDA 10.2, we provide the contents of <cstddef>, <cstdint>, <type_traits>, and <atomic>, except in cuda::std:: instead of std::, and in <cuda/std/cstddef> and so on instead of <cstddef>. Additionally, there's cuda::atomic<T, Scope>, which provides scoped atomics; the available scopes are cuda::thread_scope_{block,device,system}. cuda::std::atomic uses cuda::thread_scope_system, and atomics only free you of data races within the specified scope.

All the things provided work both on the host and on the device, and are layout compatible, which means that you can also use them in managed memory heterogeneously between the host and the device.

@griwes
griwes / gist:7fd0942175b50fea386babaa87800f76
Created March 30, 2019 20:02
MCU movie list, in Order of Enjoyment, a'la LRR Countdown to Infinity
1. Iron Man (2008)
Karawana wraków
Słońce na niebie wisi na złocony wbite hak
Pod słońcem wszystko byle jak
Rozgrzany dach, pod dachem w mojej głosie myśli huk
Motoru brzęk i drogi stuk
Przed siebie gnać z tą karawaną wraków
Łysinę pod wytartą czapkę skryć
Nie wolno spać, choć dobrze już po zmroku
"Jak się nie stoczyć"
sł. i muz. Paweł Wójcik
I znowu siedzimy Tomaszu przy stole e D
Nie sięgaj po portfel bo dziś moja kolej G D
Lubimy ten gwar, muzyczka nam gra e D
Wódeczka do dna G D
Siedzimy przy stole, coś mówisz o żonie
@griwes
griwes / cmake_hacks.md
Created June 29, 2016 12:25
stupid cmake hacks
On 03/10/2011 12:25 AM, Andreas Pakulat wrote:
> On 09.03.11 21:36:25, Ankur Handa wrote:
>> I'm using find_library to find a library in a given directory but it has
>> many different versions of this library listed as libcxcore.so,
>> libcxcore.so.2.1 and libcxcore.so.2.1.0  I wrote a very simple cmake file
>>
>> cmake_minimum_required(VERSION 2.8)
>>
Sfinks
sł. i muz. Adam Leszkiewicz
Obudź się, mówi ona a
Pójdźmy nad przepaścią FG a
Bo coś wisi w powietrzu a(bar) G(bar) (C)
I nie można zasnąć... CG
Ale popatrz, on mówi
@griwes
griwes / osdev.md
Last active December 23, 2015 11:06
#osdev.txt

klange: This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.

drake1: as long as the lock is read and modified by atomic operations

Kazinsal: because if you drag on a discussion about how to store secondary files for a fucking bootloader for more than ten minutes, you should be forced to use yaml as a filesystem as punishment

Keybase proof

I hereby claim:

  • I am griwes on github.
  • I am griwes (https://keybase.io/griwes) on keybase.
  • I have a public key whose fingerprint is C218 EB21 1690 C4DC E124 2E4D D041 9DBA 618B 12D5

To claim this, I am signing this object:

template<typename Type, typename Tag = class default_tag>
struct list_mixin
{
Type * prev = nullptr;
Type * next = nullptr;
};
template<typename CRTP, typename... Tags>
struct list_mixins : list_mixin<CRTP, Tags>...
{
@griwes
griwes / gist:b85a79dd91698aa47f3c
Last active August 29, 2015 14:21
Vapor language - `mutable` vs `const` vs immutable

C++ has three categories of constness - the default one, so "mutable", mutable which walks around const, and const, which stops modification, but not of mutable members. This is obviously kind of backwards, and that's because the default is not immutable.

Rust has two categories of constness - the default one, so immutable, and mut, which marks a declaration as mutable. This is also obviously wrong, because you cannot have a "this might be mutated, but you cannot do that" kind of a, say, argument to a function. One could say this is justified, because it makes creating data races harder, but I'd like to argue that that is not true in any aspect, at least in the "mutable and non-unique means an actor" model of Vapor.

Vapor has three categories of reference constness:

  • the default one, so immutable; the default kind of a reference is called "a reference to an immutable object"
  • mutable, which allows modification to an object. You can have multiple references to a mutable object, but once you