See comment below.
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
/* | |
Compare single thread pure integer performance of CPUs and [AMD] GPUs | |
hipcc hip-magic.hip | |
cpplint --filter=-legal/copyright hip-magic.hip.cpp | |
cppcheck --enable=all --suppress=missingIncludeSystem hip-magic.hip.cpp --check-config | |
*/ | |
#include <sys/time.h> | |
#include <stdint.h> | |
#include <hip/hip_runtime.h> |
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
see comments |
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
/* | |
TSP Ruin and Recreate greedy implementation with random+sequential+radial ruins: | |
https://www.semanticscholar.org/paper/Record-Breaking-Optimization-Results-Using-the-Ruin-Schrimpf-Schneider/4f80e70e51e368858c3df0787f05c3aa2b9650b4 | |
c++ -O3 -std=c++17 -Wall -Wextra -pedantic pcb442.cpp -o pcb442 -lstdc++ -lm | |
(tested with g++ and clang++) | |
for tour display | |
- append compiler flags "-Dezxdisp -lezx -lX11" | |
- after "make install" of ezxdisp repo first: |
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
/* based on: | |
https://medium.com/@justup1080/tutorial-creating-a-minimalist-http-server-in-c-2303d140c725 | |
gcc -Wall -Wextra -pedantic range_http.c -o range_http | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <netinet/in.h> |
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
#!/bin/bash | |
d=$(find /sys/class/drm/card?/device/unique_id | wc --l) | |
printf "%9s" "$(hostname)" | |
for((c=0;c<d;++c)) | |
do | |
printf "|%s" "$(cat /sys/class/drm/card$c/device/unique_id)" | |
done | |
echo "|" |
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
"use strict" | |
const jscad = require('@jscad/modeling') | |
const { translate, rotate, scale:scale3d } = jscad.transforms | |
const { vec3 } = jscad.maths | |
const { colorize } = jscad.colors | |
const { sphere, cylinder } = jscad.primitives | |
const { add, length, subtract, scale } = jscad.maths.vec3 | |
const phi=(Math.sqrt(5)+1)/2; | |
const build=[[0,1,3*phi],[1,2+phi,2*phi],[phi,2,2*phi+1]]; |
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
"use strict"; | |
const jscad = require("@jscad/modeling"); | |
const { vec2, vec3} = jscad.maths; | |
const { bezier} = jscad.curves; | |
const { rotate, scale, translate } = jscad.transforms; | |
const { cuboid, sphere, cylinder } = jscad.primitives; | |
const { colorize } = jscad.colors; | |
const r=40; | |
const w=20; |
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
f1(N)={isprimepower(N,&r);return(r);} | |
f2(N)={return(lift(gcd(Mod(2,N)^N-2,N)));} | |
measure(f,N)={t0=getwalltime();f(N);t1=getwalltime();return(t1-t0);} | |
print("runtimes in milliseconds, with N=nextprime(base)^expo\n"); | |
print("isprimepower(N,&r);return(r)"); | |
{ | |
printf(" |");for(e=2,15,printf("%3d|",e));print(); |
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
"use strict" | |
const jscad = require('@jscad/modeling') | |
const { translate, rotateZ } = jscad.transforms | |
const { cuboid, sphere } = jscad.primitives | |
function main() { | |
return rotateZ(Math.PI/2,[ | |
cuboid({size: [70,10,10]}), | |
translate([0,50,0], cuboid({size: [70,10,10]})), | |
translate([0,100,0], cuboid({size: [70,10,10]})), |
NewerOlder