Skip to content

Instantly share code, notes, and snippets.

View alfanick's full-sized avatar
💭
I may be slow to respond.

Amadeusz Leonardo Juskowiak alfanick

💭
I may be slow to respond.
View GitHub Profile
@alfanick
alfanick / abstract.md
Last active August 17, 2016 16:19
Funny doubles behaviour
clang++ clang++/fast-math g++ g++/fast-math
Naive 36028796817637376 36028796884746240 36028796817637376 36028796884746240
Naive OpenMP 36028796884746240 36028796884746240 36028796884746240 36028796884746240
Vectorization 36028796884746240 36028796884746240 - -

Correct answer -- 36028796884746240

  • clang++ -- clang++ -march=native -O3 -std=c++11 -fopenmp -L/usr/local/opt/llvm/lib -o main ./main.cpp
  • clang++/fast-math -- clang++ -march=native -O3 -std=c++11 -fopenmp -ffast-math -L/usr/local/opt/llvm/lib -o main ./main.cpp
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <assert.h>
def include_tex(code)
code.gsub /\\\input{"(.+)"}/ do
include_tex(File.read(Regexp.last_match[1]))
end
end
File.write(ARGV[0] ||= 'thesis.tex', include_tex(File.read(ARGV[0])))
#!/usr/bin/env ruby
require 'rubygems'
require 'logger'
require 'yaml'
require 'fileutils'
require 'csv'
require 'gruff'
module CUDA
n k Jakość Pamięć [B] Czas [s]
200 10 100% 1060864 0.08
200 11 100% 1003520 0.09
200 12 100% 1044480 0.10
200 13 100% 1044480 0.11
200 14 100% 1060864 0.11
200 15 100% 1064960 0.12
200 16 100% 1077248 0.13
210 10 100% 1019904 0.09
210 11 100% 1040384 0.09
" Vim syntax file
" Language: xc (XMOS C)
" Maintainer: Fred Barnes <frmb@kent.ac.uk>
" Last Change: 01/11/2008
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
@alfanick
alfanick / parallel.swift
Created June 7, 2014 07:01
Apple Grand Central Dispatch (GCD) in Swift
import Foundation
func async(block: () -> (), priority: Int = DISPATCH_QUEUE_PRIORITY_DEFAULT) {
dispatch_async(dispatch_get_global_queue(priority, 0), block)
}
func par(count: UInt, block: (UInt) -> (), priority: Int = DISPATCH_QUEUE_PRIORITY_DEFAULT) {
dispatch_apply(count, dispatch_get_global_queue(priority, 0), block)
}
@alfanick
alfanick / README
Last active December 29, 2015 18:39
Ant do droolsa
Config do drools do anta. Koniec z eclipse, tworzy jarke do dwukliku, pliki możecie wrzucić do środka i korzystać z Class::getResource().
Założenia:
- w lib/ znajduja się wasze dodatkowe jarki, w lib/drools koniecznie (!) znajdują się jarki droolsa, musicie je gdzieś znaleźć, może być symlink do nich
- do lib musicie też skopiować magiczny plik z eclipse/plugins - org.eclipse.jdt.core_3.9.1.v20130905-0837.jar
- w src są pliki źródłowe
- nazwa klasy z mainem to com.sample.DroolsTest - można zmienić - linia #8
- w katalogu src/main/rules są pliki drl, kopiowane do jarki
- w katalogu rsc są wasze różne pliki - u mnie yaml z pytaniami, można zmienić, linie #31-33, quite obvious
- w linii #2 można zmienić nazwę projektu, zbudowana jarka jest w build/jar i zawiera wszystko co potrzebne