Jakob ¡Lü)gau ¡ 9lue)ga@informa5k.uni-‑hamburg.de ¡
7
¡ Drop7 ¡+ ¡Problembeschreibung ¡ ¡ Punkt ¡1: ¡drop7.c ¡ Punkt ¡2: ¡mpi_queue.c ¡ Punkt ¡3: ¡sed ¡‘s/item/d7/g‘ ¡queue_mpi.c ¡ ¡ Leistungsanalyse ¡ ¡ Optimierungsmöglichkeiten ¡
2 +39 +7 +7 +7 3 23 23 ¡ ¡ ¡ ¡ ¡ ¡ ¡ puff ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡
Titanium ¡Backup, ¡zum ¡Sichern ¡von ¡Apps ¡=> ¡com.areacode.drop7.apk ¡ h)ps://play.google.com/store/apps/details?id=com.keramidas.TitaniumBackup&hl=de ¡ APK ¡Tool, ¡zum ¡Extrahieren ¡der ¡Ressourcen ¡und ¡Assets ¡einer ¡App ¡=> ¡Sequence.dat ¡ h)p://code.google.com/p/android-‑apktool/downloads/list ¡ Dex2Jar, ¡Decompile ¡App ¡to ¡*.jar, ¡zwar ¡nicht ¡direkt ¡ lauffähig ¡aber ¡wir ¡wollen ¡ja ¡nur ¡Lesen ¡ h)p://code.google.com/p/dex2jar/ ¡ ¡ JD-‑Gui ¡kann ¡*.jar ¡Dateien ¡decompilieren ¡und ¡lässt ¡einen ¡die ¡ Quelldateien ¡lesen ¡ h)p://java.decompiler.free.fr/?q=jdeclipse ¡
:/ ¡
7 3750
� � � Punkt 1: � drop7.c � Punkt 2: � mpi_queue.c � Punkt 3: �� find ./ -type f | xargs sed –i ‘s/item/d7/g‘ �
7 . ¡ .c drop
� � � � � � #define D7_STATUS_CALCULATE 0 � d7 dropdisc(d7, int col, int disc); � d7 calcturn(d7); � #define D7_STATUS_REQUIRE_DISC 1 � #define D7_STATUS_GAME_OVER 2 � d7_impact poppers_col(d7); � d7_impact poppers_row(d7); � typedef struct d7 { � � int m[7][7]; // Spielfeld � � int sequence[3750]; // Spielfolge � d7_impact merge_impact(d7_impact, d7_impact); � � int score; � � int level; � d7 apply_impact(d7, d7_impact, int depth); � � int nextleveldiscs; � � int turn; � d7 gravity(d7); � � int discs; � � int status; � � int depth; � d7 levelup(d7, int* row); � } d7; � levelup() ¡ dropdisc() ¡ Game ¡ Calc. ¡ Require ¡ Start ¡ Over ¡ Disc ¡ Turn ¡ while( ¡impact ¡!= ¡0 ¡) ¡
� � � � � � #include <stddef.h> � #include <mpi.h> � #include "d7.h" � MPI_Datatype mpi_d7; � MPI_Datatype types[] = { MPI_INT, MPI_INT, MPI_INT }; � int blocklengths[] = { 7*7, 3750, 1 }; � MPI_Aint displacements[] = { offsetof(d7, m), � � � � � � � � � � offsetof(d7, sequence), � � � � � � � � � � offsetof(d7, score) }; � MPI_Init( &argc, &argv ); � MPI_Type_create_struct( 3, � � blocklengths, displacements, types, &mpi_d7 ); � MPI_Send( &buf, 1, mpi_d7, rank, tag, MPI_COMM_WORLD ); �
� � struct item * queue; � int queue_len = 3; � int queue_count = 0; � void grow(); � int push(item); � item pop(); � queue = malloc((item*)3*sizeof(item)); � push(f); � push(u); � push(a); � � grow(); � push(l); � push(d); � push(t); � a � d � e � � grow(); � a � d � � � dumpPartOfQueue(); � a � d � e � f � a � d � e � f � u � l � push(e); � a � d � e � a � d � e � t � void grow() � { � � item * tmp = (item*)realloc(queue, queue_len * sizeof(item) + 3); � � if (tmp == NULL) � � � // Out of memory. � � � dumpPartOfQueueToFile(); � � else � � � queue = tmp; � } �
� � � #include "tpl.h" � void dumpQueue() { � � tpl_node *tn; � � tn = tpl_map("A(S(i##i#iiiiiii))", &queue, 7, 7, 3750); � �� � for ( int t = 0; t < queue_count; ++t) tpl_pack(tn,1); � � tpl_dump(tn, TPL_FILE, "dump.tpl"); � � tpl_free(tn); � } � Serialisierung ¡mit ¡TPL: ¡h)p://tpl.sourceforge.net/ ¡ void loadQueueFromFile(struct dirent entry) { � � tpl_node *tn; � � d7 agame; � � tn = tpl_map("A(S(i##i#iiiiiii))", &agame, 7, 7, 3750); � � tpl_load(tn, TPL_FILE, "dump.tpl"); � � while (tpl_unpack(tn,1) > 0) � � � push(agame); � � tpl_free(tn); � } �
Worker � Master � d7 * queue; � d7 * queue; � d7 best; � d7 best; � Init ¡ Init ¡ work(); � sendReport(); � gatherReports(); � recvBest(); � BcastBest(); � Normal ¡ Normal ¡ recvDemands(); � sendDemands(); � sendRecvDemanded(); � recvDemanded(); � balance(); � Finalize ¡ Finalize ¡
luettgau@cluster:~/drop7cmpi$ module load hdtrace/1.0-complete � ModuleCmd_Load.c(204):ERROR:105: Unable to locate a modulefile for 'hdtrace/1.0-complete‘ � Recv ¡Demanded ¡ Recv ¡Demanded ¡ Gather ¡Reports ¡ Gather ¡Reports ¡ Gather ¡Reports ¡ Send ¡Demands ¡ Send ¡Demands ¡ Balance ¡ Balance ¡ 0 � 1 � 2 � 3 � working ¡
Leistungsanalyse ¡ 1E+15 ¡ 1E+14 ¡ 1E+13 ¡ 1E+12 ¡ 1E+11 ¡ 1E+10 ¡ Turns ¡per ¡minute ¡ 1E+09 ¡ 100000000 ¡ 10000000 ¡ 1000000 ¡ 100000 ¡ 10000 ¡ 1000 ¡ 100 ¡ 10 ¡ 1 ¡ Cores ¡ 2 ¡ 4 ¡ 8 ¡ 16 ¡ 32 ¡ 64 ¡ 128 ¡ Turns ¡/ ¡Min. ¡ 1347179 ¡ 3017708 ¡ 5715230 ¡ 10542499 ¡ 17325913 ¡ 20684082 ¡ 33955173 ¡ Linear ¡Performence ¡ 1347179 ¡ 5388716 ¡ 43109728 ¡ 689755648 ¡ 22072180736 ¡ 1,41262E+12 ¡ 1,80815E+14 ¡
Queue ¡Counts ¡at ¡IteraBon ¡(x/2), ¡240 ¡Cores ¡(100000 ¡Turns ¡per ¡IteraBon) ¡ 40000 ¡ Master ¡ Worker ¡1 ¡ 35000 ¡ Worker ¡2 ¡ Worker ¡3 ¡ Worker ¡4 ¡ 30000 ¡ Worker ¡5 ¡ Worker ¡6 ¡ Worker ¡7 ¡ 25000 ¡ Worker ¡8 ¡ Items ¡in ¡local ¡queue ¡ Worker ¡9 ¡ Worker ¡10 ¡ 20000 ¡ Worker ¡11 ¡ Worker ¡12 ¡ 15000 ¡ Worker ¡13 ¡ Worker ¡14 ¡ Worker ¡15 ¡ 10000 ¡ Worker ¡16 ¡ Worker ¡17 ¡ Worker ¡18 ¡ ¡ 5000 ¡ Worker ¡19 ¡ Generated: ¡9.1 ¡TB ¡ Worker ¡20 ¡ Final ¡Queue ¡Size: ¡21 ¡GB ¡ Worker ¡21 ¡ 0 ¡ 1 ¡ 10 ¡ 19 ¡ 28 ¡ 37 ¡ 46 ¡ 55 ¡ 64 ¡ 73 ¡ 82 ¡ 91 ¡ 100 ¡ 109 ¡ 118 ¡ 127 ¡ 136 ¡ 145 ¡ 154 ¡ 163 ¡ 172 ¡ 181 ¡ 190 ¡ 199 ¡ 208 ¡ 217 ¡ 226 ¡ 235 ¡ 244 ¡ 253 ¡ 262 ¡ 271 ¡ 280 ¡ 289 ¡ 298 ¡ 307 ¡ 316 ¡ 325 ¡ 334 ¡ 343 ¡ 352 ¡ 361 ¡ 370 ¡ 379 ¡ 388 ¡ 397 ¡
Ideen Berechnung � Ideen Kommunikation � • Worker-Worker Kommunikation � • Lernfähige Arbeitsperiodenlänge � – Hypercube/Ringe � – z.B. Rank 200 macht 2000 Zyklen mehr als Rank � • Quasi-Null-Kommunikation � • pthreads beim Warten auf • Komprimierung � Lastausgleich � • Spiel-Heuristik � • etwas breitere Suche � Sonstiges � Ideen I/O � Effizientere Checkpoints � • Eingeschränkte Suchräume, beste • Ergebnisse eines eingeschränkten – minimale Schnitte im Baum, aber das liefert die Queue sogar schon. � Suchraums werden dann weiter benutzt. � Komprimierung � • • Betrachte nicht nur beendete Spiele, – Daten haben relativ geringe Entropie?, sondern auch Spiele die schon einen Unterstützt werden sollte auch das durch die hohen Score haben. � Tiefensuche (666123, 666213, 666163 ...) � Worker speichern Daten bei sich • selbst. �
7 7 7 4 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 6 6 7 6 7 6 6 6 6 6 6 5 5 5 7 7 7 7 7 7 7 6 6 6 6 7 6 6 5 5 6 6 6 5 5 5 5 5 5 5 5 7 7 7 7 7 7 7 7 7 6 7 7 7 5 3 3 4 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 7 3 5 3 5 2 4
7 7 7 4 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 6 6 7 6 7 6 6 6 6 6 6 5 5 5 7 7 7 7 7 7 7 6 6 6 6 7 6 6 5 5 6 6 6 5 5 5 5 5 5 5 5 7 7 7 7 7 7 7 7 7 6 7 7 7 5 3 3 4 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 7 3 5 3 5 2 4 Scores: 345294
Recommend
More recommend