Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: pform/pfgw/bench.cpp
- ===================================================================
- --- pform/pfgw/bench.cpp (revision 643)
- +++ pform/pfgw/bench.cpp (working copy)
- @@ -121,6 +121,7 @@
- Integer *pResult=ex_evaluate(pTestContext,expr);
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- if (CreateModulus(pResult, g_cpTestString, true)) return false;
- @@ -353,7 +354,9 @@
- else if (n > 1000) n = n - (n % 1000);
- else if (n > 100) n = n - (n % 100);
- - gwmap_to_fft_info(&gwdata, k, b, 90, c);
- + gwinit(&gwdata);
- + gwset_num_threads(&gwdata, g_Nthreads);
- + gwinfo(&gwdata, k, b, 90, c);
- gwfft_description (&gwdata, last_fftlen);
- @@ -361,7 +364,9 @@
- {
- if (g_bExitNow) break;
- - if (gwmap_to_fft_info(&gwdata, k, b, n, c) > 1) break;
- + gwinit(&gwdata);
- + gwset_num_threads(&gwdata, g_Nthreads);
- + if (gwinfo(&gwdata, k, b, n, c) > 1) break;
- gwfft_description (&gwdata, next_fftlen);
- Index: pform/pfgw/gf_factorize.cpp
- ===================================================================
- --- pform/pfgw/gf_factorize.cpp (revision 643)
- +++ pform/pfgw/gf_factorize.cpp (working copy)
- @@ -235,6 +235,7 @@
- Timer.Start();
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- gwsetmaxmulbyconst(&gwdata, base); // maximum multiplier
- if (CreateModulus(N, g_cpTestString, true, fftSize)) return 0;
- Index: pform/pfgw/gfn_prp.cpp
- ===================================================================
- --- pform/pfgw/gfn_prp.cpp (revision 643)
- +++ pform/pfgw/gfn_prp.cpp (working copy)
- @@ -70,6 +70,7 @@
- {
- // create a context
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- gwsetmaxmulbyconst(&gwdata, iBase); // maximum multiplier
- if (CreateModulus(1.0,base,_exp,1)) return FALSE;
- @@ -81,6 +82,7 @@
- fftSize++;
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- gwsetmaxmulbyconst(&gwdata, iBase); // maximum multiplier
- if (CreateModulus(1.0, base, _exp, 1, fftSize)) return false;
- Index: pform/pfgw/gw_gapper.cpp
- ===================================================================
- --- pform/pfgw/gw_gapper.cpp (revision 643)
- +++ pform/pfgw/gw_gapper.cpp (working copy)
- @@ -76,6 +76,7 @@
- // create a context
- gwinit2(&gwdata, sizeof(gwhandle), GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- gwsetmaxmulbyconst(&gwdata, iBase); // maximum multiplier
- if (CreateModulus(N, g_cpTestString)) return false;
- Index: pform/pfgw/gw_prp.cpp
- ===================================================================
- --- pform/pfgw/gw_prp.cpp (revision 643)
- +++ pform/pfgw/gw_prp.cpp (working copy)
- @@ -88,6 +88,7 @@
- fftSize++;
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- gwsetmaxmulbyconst(&gwdata, iBase); // maximum multiplier
- if (CreateModulus(N, g_cpTestString, true, fftSize)) return -2;
- @@ -112,7 +113,7 @@
- // create a context
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- -
- + gwset_num_threads(&gwdata, g_Nthreads);
- testN = *N;
- gwsetmaxmulbyconst(&gwdata, iBase); // maximum multiplier
- if (CreateModulus(N, g_cpTestString, true)) return;
- Index: pform/pfgw/pfgw_globals.h
- ===================================================================
- --- pform/pfgw/pfgw_globals.h (revision 643)
- +++ pform/pfgw/pfgw_globals.h (working copy)
- @@ -3,6 +3,7 @@
- extern int iBase;
- extern int g_nIterationCnt;
- +extern int g_Nthreads;
- extern bool volatile g_bExitNow;
- extern bool volatile g_bExited;
- extern unsigned long clocks_per_sec; // Machine dependent
- Index: pform/pfgw/pfgw_main.cpp
- ===================================================================
- --- pform/pfgw/pfgw_main.cpp (revision 643)
- +++ pform/pfgw/pfgw_main.cpp (working copy)
- @@ -46,6 +46,7 @@
- PFIni *g_pIni;
- int g_nIterationCnt=2500;
- int g_CompositeAthenticationLevel = 0; // valid values are 0, 1, 2, 3, 4, 5
- +int g_Nthreads = 1;
- int g_ExtraSQFree = 100;
- int g_Cert_Type = -1;
- int g_Cert_Delete = -1;
- @@ -223,7 +224,7 @@
- {cl_illegal, false, ""}, // Q
- {cl_illegal, false, ""}, // R
- {cl_illegal, false, ""}, // S
- - {cl_illegal, false, ""}, // T
- + {cl_integer, true, "_NTHREADS"}, // T
- {cl_illegal, false, ""}, // U
- {cl_boolean, false, "_VERBOSE"}, // V
- {cl_illegal, false, ""}, // W
- @@ -320,7 +321,10 @@
- \n\
- -g<o> Test for factors of GFN's. If -go then ONLY test for factors (no PRP).\n\
- -gx<o> Test for factors of \"extended\" GFN's. xGFN's form is a^2^n+b^2^n\n\
- -\n";
- +\n\
- +-T<number> performs tests using multiple threads.\n\
- +\n\
- +";
- LPCTSTR Help_Text5 = "\
- --===ADVANCED OPTIONS FOR DETERMINSTIC TESTS===--\n\
- \n\
- @@ -515,7 +519,7 @@
- if (cParameter == 0 && clList[iIndex].required)
- {
- PFOutput::EnableOneLineForceScreenOutput();
- - PFPrintfStderr("Switch %s requires a string parameter\n", LPCTSTR(s));
- + PFPrintfStderr("Switch %s requires an integer parameter\n", LPCTSTR(s));
- return false;
- };
- @@ -526,7 +530,7 @@
- if (cParameter == 0 && clList[iIndex].required)
- {
- PFOutput::EnableOneLineForceScreenOutput();
- - PFPrintfStderr("Switch %s requires a string parameter\n", LPCTSTR(s));
- + PFPrintfStderr("Switch %s requires an integer parameter\n", LPCTSTR(s));
- return false;
- };
- @@ -654,6 +658,7 @@
- }
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- if (gwdata.GWERROR == GWERROR_VERSION_MISMATCH)
- {
- @@ -786,6 +791,18 @@
- g_CompositeAthenticationLevel = 5;
- }
- + g_Nthreads=1; // default, run on 1 thread
- + pSymbol=psymRuntime->LookupSymbol("_NTHREADS");
- + if(pSymbol && pSymbol->GetSymbolType()==INTEGER_SYMBOL_TYPE)
- + {
- + Integer INthreads=*(((PFIntegerSymbol*)pSymbol)->GetValue());
- + char *cp = INthreads.Itoa();
- + g_Nthreads = atoi(cp);
- + delete[] cp;
- + if (g_Nthreads < 1)
- + g_Nthreads = 1;
- + }
- +
- // Communicate these values to any SCRIPT so that it knows what the
- // "defaults" for factorizing are.
- g_MinStartingPrimeToFactor=g_MaxStoppingPrimeToFactor=0;
- Index: pform/pfgw/phi_prp.cpp
- ===================================================================
- --- pform/pfgw/phi_prp.cpp (revision 643)
- +++ pform/pfgw/phi_prp.cpp (working copy)
- @@ -196,6 +196,7 @@
- // calculate 2^iPhi mod Q
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- gwsetmaxmulbyconst(&gwdata, 2); // maximum multiplier
- if (CreateModulus(&Q, g_cpTestString, true)) return;
- @@ -265,6 +266,7 @@
- fftSize++;
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- gwsetmaxmulbyconst(&gwdata, iBase); // maximum multiplier
- gwset_larger_fftlen_count(&gwdata, fftSize);
- Index: pform/pfio/pfscriptfns.cpp
- ===================================================================
- --- pform/pfio/pfscriptfns.cpp (revision 643)
- +++ pform/pfio/pfscriptfns.cpp (working copy)
- @@ -9,6 +9,7 @@
- extern char g_ModularSieveString[256];
- extern int g_nIterationCnt;
- +extern int g_Nthreads;
- bool CheckForFatalError(const char *caller, GWInteger *gwX, int currentIteration, int maxIterations, int fftSize);
- @@ -688,6 +689,7 @@
- int i, s, iterations;
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- CreateModulus(&n, modulus);
- Index: pform/pfoo/algebra.cpp
- ===================================================================
- --- pform/pfoo/algebra.cpp (revision 643)
- +++ pform/pfoo/algebra.cpp (working copy)
- @@ -8,6 +8,7 @@
- extern bool volatile g_bExitNow;
- extern char g_cpTestString[70];
- +extern int g_Nthreads;
- FiniteField::~FiniteField()
- {
- @@ -34,6 +35,7 @@
- FieldZ::FieldZ(Integer *N)
- {
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- gwsetmaxmulbyconst(&gwdata, GWMULBYCONST_MAX); // maximum multiplier
- CreateModulus(N, g_cpTestString);
- }
- @@ -209,6 +211,7 @@
- : ps1(NULL), ps2(NULL), ps3(NULL), ps4(NULL)
- {
- gwinit2(&gwdata, sizeof(gwhandle), (char *) GWNUM_VERSION);
- + gwset_num_threads(&gwdata, g_Nthreads);
- gwsetmaxmulbyconst(&gwdata, GWMULBYCONST_MAX); // maximum multiplier
- CreateModulus(N, g_cpTestString);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement