//////////////////////////////// //FOR BUFFALO COMPILER DEPEND # /////////////////////////////// //g++ -ansi -O1 -Wno-write-strings -m64 -lpthread -fopenmp -mtune=core2 -march=core2 -fomit-frame-pointer ficat7.cc -o ficat7 //g++ -ansi -O3 -Wno-write-strings -ftree-vect-loop-version -m64 -lpthread -fthread-jumps -fopenmp -mtune=core2 -march=core2 -fomit-frame-pointer ficat7.cc -o ficat7 //g++ -ansi -O3 -mssse3 -Wno-write-strings -m64 -lpthread -fopenmp -mtune=core2 -march=core2 -fomit-frame-pointer ficat7.cc -o ficat7 ////////////////////////////// // FOR INTEL COMPILER DEPEND # ////////////////////////////// //LANG=C; export LANG //KMP_BLOCKTIME=0;export KMP_BLOCKTIME //LD_LIBRARY_PATH=/opt/intel/Compiler/11.1/059/lib/intel64;export LD_LIBRARY_PATH //./icpc -ansi -fast -static -O2 -axSSSE3 -lpthread -openmp -openmp-lib=compat -march=core2 -mtune=core2 ficat7.cc -o ficat7 //FOR BINARY AS SHARED ICC //./icpc -fPIC -ansi -shared-intel -axSSSE3 -Os -fast -openmp -openmp-lib=compat -openmp-report -march=core2 -mtune=core2 -fomit-frame-pointer ficat7.cc -o ficat7 // RUN BEFORE SYNC COMMAND SHELL BEFORE START ONE OFF TWO BUILD TYPE TIME COMPARE // echo 0 > /proc/sys/kernel/sched_compat_yield (IS DEFAULT) // echo 1 > /proc/sys/kernel/sched_compat_yield (FOR BOOST #) #include #include #include #include #include #include #include int aleat (int u) { int r = rand (); if (r < 0) r = -r; return 1 + r % u; } int rdtsc() { __asm__ __volatile__("rdtsc"); return(NULL); } //////////////////////////////////////////////////////////////////////////////// //VOID COUNT_ARRAY_OCCURS FOR COUNT ARRAY OCCURRENCES ASYNCHRONY IN AN STRING// //////////////////////////////////////////////////////////////////////////////// int count_array_occurs (char *a, char **b, int c, int d, int e) { // A IS GLOBAL STRING WHERE MUST COUNTED OCCURRENCE // B IS ARRAY OF WORDS OCCURRENCES AS MUST COUNTED IN A // C IS SIZE CALLED OF ARRAY // D IS NUMBER PROBABILITY OCCURENCES RELATION REQUIRED TO AN DEDUCTION // E IS NUMBER THREADS int la = strlen (a); //SIZE STRING RECEIVED int lc[c]; //ARRAY SIZED TO C int noc[c]; //ARRAY SIZED TO C int pos[la][c]; //ARRAY SIZED TO 2 CHUNKS: SIZE STRING & NUMBER ELEMENT REQUIRED FINDING int j; int x; int k; int p = 0; int af = 0; int gtn=0; int v=0; int i=0; char * ve[c]; //NEW ARRAY FOR RECEIVE ALEATORY (OLD IS STATIC ELEMENT MEMORY POINTED) // cpu_set_t mask; // WITH OR WITHOUT AFFINITY 2 FUNCTIONS SAME (PROBLEM ???) ICC omp_set_nested (0); // omp_set_dynamic (0); omp_set_num_threads (0); omp_set_num_threads (e); // 2 AS DEFAULT //NUM THREAD DEPEND FOR FREE THAT YOU NOT HAVE USE (IMPROVE FOR ALL SYSTEM) //kmp_set_blocktime (0); //FOR LEADED //UNKOWN FOR BUFFALO #pragma omp parallel for private(v) // FOR ARRAY ALEATORY //DISABLE = IMPROVE /2 for (v = 0; v <= c-1 ; v++) //LOOP TO INITIALIZE ARRAY IN SALAD { ve[i]= b[v]; lc[i] = strlen (ve[i]); noc[i] = 0; i++; } #pragma omp parallel shared(a,p) private(j,k,x) { for (int i = 0; i <= c-1 ; i++) //LOOP FIRST LEVEL { gtn = omp_get_thread_num (); // HERE RECEIVED BY ICC CORRECT THREAD //std::cout << "[FL " << gtn << " ]"; if ((i % 2) == 0) //ALTERNATE CONDITION PAIR IMPAIR TO AFFINITY # 0 & 1 (SEE VOID ALEAT ADDED TO BIG MACHINE) { af = 0; } else { af = 1; } cpu_set_t mask; CPU_ZERO (&mask); CPU_SET (af, &mask); if (sched_setaffinity (af, sizeof (cpu_set_t), &mask) < 0) { perror ("sched_setaffinity"); } //std::cout << "[AF " << af << " ]\n"; //HERE BUFFALO GIVE AFFINITY ALTERNATE WORKING, ICC ALSO if (p >= d ) //FLAG HALT POINT if (p > d || gtn ==0 ) TO VERIFY ICC ALWAY REAL THREAD 0 { i = c - 1; } //ALTERNATE CONDITION PAIR IMPAIR TO AFFINITY # 0 & 1 (SEE VOID ALEAT ADDED TO BIG MACHINE ########) //USE ONLY NOWAIT WITH THIS SPECIFIC SOURCE #pragma omp sections nowait // { #pragma omp section for (j = 0; j <= la ; j++) //SECONDARY LEVEL { gtn = omp_get_thread_num (); //HERE THIS LEVEL INTEL ICC && BUFFALO SHOW THREAD //std::cout << " " << gtn; // UNCOMENT TO SHOW ALL THREADS OK OR 0 x = 0; if (a[j] == ve[i][0]) { for (k = j; k <= j + lc[i]-1 ; k++) //THIRD LEVEL LOOP,HERE STRANGE WITH ICC ß [ 0 ] [ # 2 ] { if (a[k] == ve[i][x] && x <= lc[i]-1 ) // && FOR HALT BEFORE MORE OCCURENCES EXISTING { x++; } if (x == lc[i] && noc[i]<=d-1 && p<=d-1) // && FOR HALT BEFORE MORE OCCURENCES EXISTING { noc[i]++; pos[noc[i]][i] = k - x; p++; gtn = omp_get_thread_num (); //HERE INTEL SHOW 0 NEAL, BUFFALO SHOW NICE ALL THREAD ... std::cout << " [ß " << gtn << " ]"; //IS OTHER ENVIRONMENT EXIST LEADED DEFAULT ?? std::cout << " [ # " << omp_get_num_procs () << "," < " << ve[i] << std::endl; int m = 1; while (pos[m][i] != 0) { //ENABLE TO SHOW POSITION // std::cout << pos[m][i] << " <-POS-> " << ve[i] << " <-TO-> " << pos[m][i] + strlen (ve[i]) << std::endl; m++; } } } return (0); } int main (int argc, char *argv[]) { if (argv[1]==0 || argv[2]==0 ) { std::cout << " Parameter required \n Name program (number occurences ) (number threads)"<< std::endl; exit(0); } char testocc[68096] ; // USE THIS SIZE ICC OR GREATER TO INCREASE RESERVED SPACE (no Segmentation fault with trace) char * strtab [40] = {"another","Non-Commercial ","display","copy","Site","1.","2.","3.","4.","5.","6.","7.","8.","9.","Unless","as","and","personal","any","forum", "Non", "system", "otherwise", "vulgar", "not", "state", "computer", "on", "the", "server", "to","e","Intel", "faults", "pre", "ch", "na", "is", ",", "." }; int nps = atoi(argv[1]); int nt = atoi(argv[2]); memset(testocc,0,68096); strcpy (testocc,"Personal Non-Commercial Use: This Web Site is for personal and non-commercial use. Unless otherwise specified or as provided in these Terms, you may not modify, copy, distribute, transmit, display, perform, reproduce, publish, license, create derivative works from, transfer, or sell any information, software, products or services obtained from the Materials\nNo Unlawful or Prohibited Use: You agree that you will not use the Web Sites or Material for any purpose that is unlawful or prohibited by these Terms of Use. You may not:\n 1. upload, post, email, transmit or otherwise make available any content that is unlawful, harmful, threatening, abusive, harassing, tortuous, defamatory, vulgar, obscene, libelous, invasive of another's privacy, hateful, or racially, ethnically or otherwise objectionable;\n 2. use the Web Sites, Materials, Services or activities to \"stalk\" or otherwise harass or harm another;\n 3. impersonate any person or entity, including, but not limited to, an Intel official, forum leader, guide or host, or falsely state or otherwise misrepresent your affiliation with a person or entity or collect or store personal data about other users in connection with the prohibited conduct and activities;\n 4. forge headers or otherwise manipulate identifiers in order to disguise the origin of any content transmitted through the Web Site or Materials;\n 5. upload, post, email, transmit or otherwise make available any content that you do not have a right to make available under any law or under contractual or fiduciary relationships (such as inside information, proprietary and confidential information learned or disclosed as part of employment relationships or under nondisclosure agreements);\n 6. upload, post, email, transmit or otherwise make available any content that infringes any patent, trademark, trade secret, copyright or other proprietary rights (\"Rights\") of any party;\n 7. upload, post, email, transmit or otherwise make available any unsolicited or unauthorized advertising, promotional materials, \"junk mail,\" \"spam,\" \"chain letters,\" \"pyramid schemes,\" or any other form of solicitation;\n 8. upload, post, email, transmit or otherwise make available any material that contains software viruses or any other computer code, files or programs designed to interrupt, destroy or limit the functionality of any computer software or hardware or telecommunications equipment;\n 9. you may not use the Web Site or Materials in any manner that could damage, disable, overburden, or impair any Intel server, or network(s) connections, disobey any requirements, procedures, policies or regulations of networks connected to the Web Site or Materials or interfere with any other party's use and enjoyment of the Web Sites or Materials;\n 10. you may not attempt to gain unauthorized access to any Web Site or Material, other accounts, computer systems or networks connected to any Intel server or Materials, through hacking, password mining or any other means or obtain or attempt to obtain any materials or information through any means not intentionally made available through the Web Sites or Materials;\n 11. intentionally or unintentionally violate any applicable local, state, national or international law, including, but not limited to, regulations promulgated by the U.S. Securities and Exchange Commission, any rules of any national or other securities exchange, including, without limitation, the New York Stock Exchange, the American Stock Exchange or the NASDAQ, and any regulations having the force of law; and/or\n 12. provide material support or resources (or to conceal or disguise the nature, location, source, or ownership of material support or resources) to any organization(s) designated by the United States government as a foreign terrorist organization pursuant to section 219 of the Immigration and Nationality Act.\nUS Government Restricted Rights: The Materials including Intel Software are provided with \"RESTRICTED RIGHTS.\" Use, duplication, or disclosure by the Government is subject to restrictions as set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or its successor. Use of the Materials by the Government constitutes acknowledgment of Intel \'s proprietary rights in them\n"); int v; for ( v=0 ;v<=1000; v++) // FICTIVE SMALL NUMBER RECORD TUPLES ENGINE DATABASE SIMULATE (USE OPTION NOWAIT) { count_array_occurs (testocc, &strtab[NULL], 40, nps,nt); } // count_array_occurs (testocc, &strtab[NULL], 40, nps,nt); std::cout << "\nIn sound coffe....: onSmokerOver isToFogLower()\n 2,4,8 or ++ cores, you have probably an using exact for your money, No ?.. " << std::endl; std::cout << "\nOpenMp is very very nice product.. , No ?.." << std::endl; }