Commit 5a383e68 authored by akalantz's avatar akalantz
Browse files

-np (no paraller) readded

git-svn-id: https://svn.vital-it.ch/svn/hp2c/trunk/Codeml_Variants/Fastcodeml@7205 95c5a404-1f88-0410-a6b0-c3f062b6f34a
parent 316fbebc
This diff is collapsed.
......@@ -193,3 +193,4 @@ if(MPI_LIBRARY)
endif(MPI_LIBRARY)
......@@ -128,7 +128,7 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
OPT_COMP_TIMES,
OPT_TRACE,
OPT_NUM_THREADS,
// OPT_FORCE_SERIAL,
OPT_FORCE_SERIAL,
OPT_BRANCH_FROM_FILE,
OPT_ONE_HYP_ONLY,
OPT_INIT_H0_FROM_H1,
......@@ -142,7 +142,8 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
OPT_CLEAN_DATA,
OPT_NO_PRE_STOP,
OPT_MAX_ITER,
OPT_BRANCH_LENGTH
OPT_BRANCH_LENGTH,
// OPT_FG_BRANCHES
};
// Then the definitions of each command line option
......@@ -181,8 +182,8 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
{ OPT_TRACE, "--trace", SO_NONE, "" },
{ OPT_NUM_THREADS, "-nt", SO_REQ_SEP, "Number of threads (1 for non parallel execution)" },
{ OPT_NUM_THREADS, "--number-of-threads", SO_REQ_SEP, "" },
//{ OPT_FORCE_SERIAL, "-np", SO_NONE, "Don't use parallel execution" },
//{ OPT_FORCE_SERIAL, "--no-parallel", SO_NONE, "" },
{ OPT_FORCE_SERIAL, "-np", SO_NONE, "Don't use parallel execution" },
{ OPT_FORCE_SERIAL, "--no-parallel", SO_NONE, "" },
{ OPT_BRANCH_FROM_FILE, "-bf", SO_NONE, "Do only the branch marked in the file as foreground branch" },
{ OPT_BRANCH_FROM_FILE, "--branch-from-file", SO_NONE, "" },
{ OPT_ONE_HYP_ONLY, "-hy", SO_REQ_SEP, "Compute only H0 if 0, H1 if 1" },
......@@ -209,8 +210,10 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
{ OPT_NO_PRE_STOP, "--no-pre-stop", SO_NONE, "" },
{ OPT_MAX_ITER, "-mi", SO_REQ_SEP, "Maximum number of iterations for the maximizer (default: 10000)" },
{ OPT_MAX_ITER, "--max-iterations", SO_REQ_SEP, "" },
{OPT_BRANCH_LENGTH, "-bl", SO_NONE, "The length of the branches is fixed"},
{OPT_BRANCH_LENGTH, "--branch-lengths-fixed", SO_NONE, ""},
{OPT_BRANCH_LENGTH, "-bl", SO_NONE, "The length of the brances is fixed"},
{OPT_BRANCH_LENGTH, "--branch-lengths-fixed", SO_NONE, ""},
//{OPT_ALL_BRANCHES, "-ab", SO_NONE, "Do all the branches as foreground branch (by default it does only the internal branches)"},
//{OPT_ALL_BRANCHES, "--all-branches", SO_NONE, ""},
SO_END_OF_OPTIONS
};
......@@ -313,9 +316,9 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
mTrace = true;
break;
/* case OPT_FORCE_SERIAL:
case OPT_FORCE_SERIAL:
mForceSerial = true;
break;*/
break;
case OPT_BRANCH_FROM_FILE:
mBranchFromFile = true;
......@@ -378,14 +381,17 @@ void CmdLine::parseCmdLine(int aCnt, char **aVal)
case OPT_NUM_THREADS:
mNumThreads = static_cast<unsigned int>(atoi(args.OptionArg()));
/* if (mNumThreads == 1)
mForceSerial = true;*/
if (mNumThreads == 1)
mForceSerial = true;
if (mNumThreads <=0) throw FastCodeMLFatal("Invalid number of threads");
break;
case OPT_BRANCH_LENGTH:
mFixedBranchLength = true;
mBranchLengthsFromFile = true;
break;
/*case OPT_ALL_BRANCHES:
mAllBranchesFG = true;*/
break;
}
}
......
......@@ -61,7 +61,8 @@ public:
mCleanData(false),
mStopIfNotLRT(true),
mCmdLineImpl(NULL),
mFixedBranchLength(false)
mFixedBranchLength(false)//,
// mAllBranchesFG(false)
{}
/// Destructor.
......@@ -107,7 +108,8 @@ public:
bool mCleanData; ///< Remove ambiguous or missing sites from the MSA (genes)
bool mStopIfNotLRT; ///< Stop H0 maximization when LRT cannot be satisfied
unsigned int mNumThreads; ///< Number of threads (if 1 the parallelization is disabled)
bool mFixedBranchLength; ///<fixed branch lengths
bool mFixedBranchLength; ///<Fixed branch lengths
// bool mAllBranchesFG; ///<Only internal branches as FG barnches
private:
struct CmdLineImpl;
......
......@@ -285,7 +285,7 @@ bool Forest::getBranchRange(const CmdLine& aCmdLine, size_t& aBranchStart, size_
else if(aCmdLine.mBranchStart < UINT_MAX && aCmdLine.mBranchStart >= num_branches)
{
// Invalid start value, ignoring, do all branches
if(aCmdLine.mVerboseLevel >= VERBOSE_INFO_OUTPUT) std::cout << std::endl << "Invalid branch requested. Ignoring" << std::endl;
if(aCmdLine.mVerboseLevel >= VERBOSE_INFO_OUTPUT) std::cout << std::endl << "Invalid branch requested. Ignoring" << std::endl;
aBranchStart = 0;
aBranchEnd = num_branches-1;
}
......@@ -302,7 +302,7 @@ bool Forest::getBranchRange(const CmdLine& aCmdLine, size_t& aBranchStart, size_
aBranchStart = static_cast<size_t>(aCmdLine.mBranchStart);
if(aCmdLine.mBranchEnd >= num_branches)
{
if(aCmdLine.mVerboseLevel >= VERBOSE_INFO_OUTPUT) std::cout << std::endl << "Invalid end branch requested. Ignoring" << std::endl;
if(aCmdLine.mVerboseLevel >= VERBOSE_INFO_OUTPUT) std::cout << std::endl << "Invalid end branch requested. Ignoring" << std::endl;
aBranchEnd = num_branches-1;
if(aBranchStart > 0) do_all = false;
}
......@@ -622,7 +622,7 @@ void Forest::addAggressiveReduction(ForestNode* aNode)
#ifdef NON_RECURSIVE_VISIT
void Forest::prepareNonRecursiveVisit(void)
{
// Clean the list for non-recursive visit to the trees. Clear also the list of respective parents
......@@ -673,7 +673,7 @@ void Forest::prepareNonRecursiveVisitWalker(ForestNode* aNode, ForestNode* aPare
// Store the nodes in the visit order except the root that should not be visited
// Store also the respective parent node
if(aParentNode)
{
{
aVisitList.push_back(aNode);
aParentList.push_back(aParentNode);
}
......
......@@ -34,11 +34,12 @@ class Forest
public:
/// Constructor
///
/// @param[in] aVerbose The verbosity level
/// @param[in] aVerbose The verbosity level
///
explicit Forest(unsigned int aVerbose=0)
explicit Forest(unsigned int aVerbose=0/*,
bool aOnlyInternalBranchFG=false*/)
: mNumSites(0), mCodonFreq(NULL), mInvCodonFreq(NULL), mInv2CodonFreq(NULL),
mNumBranches(0), mNumInternalBranches(0), mMarkedInternalBranch(UINT_MAX), mVerbose(aVerbose) {}
mNumBranches(0), mNumInternalBranches(0), mMarkedInternalBranch(UINT_MAX), mVerbose(aVerbose)/*, mOnlyInternalBranchFG(aOnlyInternalBranchFG)*/ {}
/// Destructor
///
......@@ -370,6 +371,11 @@ private:
#endif
unsigned int mVerbose; ///< If greater than zero prints more info
std::multimap<size_t, size_t> mSitesMappingToOriginal; ///< Map reduced site num. to list of corresponding original sites.
/*protected:
bool mAllBranchesFG; ///< Only internal branches to be processed*/
};
#endif
......
......@@ -65,14 +65,14 @@ public:
///
const std::vector<size_t>& orderSites(const std::vector<unsigned int>& aSites) const;
/// Save the parameters string for later printing.
///
/// @param[in] aFgBranch The foreground branch to which the log-likelihood refers
/// @param[in] aParamStr The parameters string
/// @param[in] aHypothesis The hypothesis (0 for H0 and 1 for H1) for which the log-likelihood has been computed
///
void saveParameters(size_t aFgBranch, std::string& aParamStr, unsigned int aHypothesis);
///
void saveParameters(size_t aFgBranch, std::string& aParamStr, unsigned int aHypothesis);
private:
const char* mFilename; ///< The file to which the results should be written. If null, no printing appear
......@@ -80,7 +80,7 @@ private:
std::map<size_t, std::pair<std::vector<unsigned int>, std::vector<double> > >
mPositiveSelSites; ///< The sites under positive selection and the corresponding probabilities for a given fg branch
mutable std::vector<size_t> mSiteOrder; ///< The new site+prob order computed by orderSites routine
std::map<size_t, std::string> mParamStr[2]; ///< The parameters string for the given fg branch and for the two hypothesis
};
......
......@@ -27,8 +27,13 @@
#endif
#endif
#ifdef _BGQ_COMPILER
#define dsyevr_ dsyevr
#endif
#ifdef __cplusplus
extern "C" {
extern "C" {
#endif
/// DSYRK performs one of the symmetric rank k operations
......@@ -287,15 +292,15 @@ double ddot_(const int *n,
/// Computes the Euclidean norm of a vector.
///
///
/// DNRM2 computes the Euclidean (L2) norm of a double precision real vector
///
/// @param[in] n Number of elements in the operand vector.
/// @param[in] dx Array of dimension (n-1) * |incx| + 1. Array x contains the operand vector.
/// @param[in] incx Increment between elements of x.
///
///
/// @return Resulting Euclidean norm.
///
///
double dnrm2_(const int *n,
const double *dx,
const int *incx);
......
......@@ -26,7 +26,7 @@
#include "BranchSiteModel.h"
#include "ParseParameters.h"
#include "VerbosityLevels.h"
#include "WriteResults.h"
#include "WriteResults.h"
#ifndef VTRACE
#ifdef _OPENMP
......@@ -49,14 +49,14 @@
///
/// @param[in] aRgc Number of command line parameters
/// @param[in] aRgv Command line parameters
///
const char* version="1.1.0";
///
const char* version="1.1.0";
int main(int aRgc, char **aRgv)
{
try
{
{
#ifdef USE_MKL_VML
// If used, intitialize the MKL VML library
......@@ -74,42 +74,34 @@ int main(int aRgc, char **aRgv)
// Adjust and report the number of threads that will be used
#ifdef _OPENMP
int num_threads = omp_get_max_threads();
//std::cout<<"max num of thr: "<< num_threads <<std::endl;
if((cmd.mNumThreads >=1)&&(cmd.mNumThreads <= num_threads))
num_threads = cmd.mNumThreads;
// std::cout<<"num of thr: "<< num_threads <<std::endl;
omp_set_num_threads(num_threads);
/*if (num_threads < 2)
int num_threads = omp_get_max_threads();
//std::cout<<"max num of thr: "<< num_threads <<std::endl;
if(num_threads < 2 || cmd.mForceSerial || cmd.mNumThreads == 1)
{
cmd.mForceSerial = true;
else
cmd.mForceSerial = false;*/
#else
num_threads = 1;
}
else if((cmd.mNumThreads >1)&&(cmd.mNumThreads <= num_threads))
{
num_threads = cmd.mNumThreads;
}
// std::cout<<"num of thr: "<< num_threads <<std::endl;
omp_set_num_threads(num_threads);
#else
cmd.mNumThreads=1;
int num_threads = 1;
int num_threads = 1;
cmd.mForceSerial = true;
#endif
/*#ifdef _OPENMP
int num_threads = omp_get_max_threads();
if(num_threads < 2 || cmd.mForceSerial)
{
cmd.mForceSerial = true;
num_threads = 1;
omp_set_num_threads(1);
}
#else
cmd.mForceSerial = true;
int num_threads = 1;
#endif*/
#endif
#ifdef USE_MPI
// Shutdown messages from all MPI processes except the master
if(!hlc.isMaster()) cmd.mVerboseLevel = VERBOSE_NONE;
#endif
#endif
std::cout <<std::endl<<"------------------"<< std::endl<<"FastCodeML V"<<version<<std::endl<<"------------------"<<std::endl;
// Write out command line parameters (if not quiet i.e. if verbose level > 0)
if(cmd.mVerboseLevel >= VERBOSE_INFO_OUTPUT)
......@@ -147,7 +139,7 @@ int main(int aRgc, char **aRgv)
if(cmd.mDeltaValueForGradient > 0.0) std::cout << "Delta value: " << cmd.mDeltaValueForGradient << std::endl;
std::cout << "Relative error: " << cmd.mRelativeError << std::endl;
if(cmd.mResultsFile) std::cout << "Results file: " << cmd.mResultsFile << std::endl;
if(cmd.mNumThreads) std::cout << "Number of threads: " << cmd.mNumThreads << std::endl;
if(cmd.mNumThreads) std::cout << "Number of threads: " << cmd.mNumThreads << std::endl;
if(cmd.mFixedBranchLength) std::cerr << "Branch lengths are fixed" << std::endl;
#ifdef _OPENMP
if(num_threads > 1)
......@@ -218,7 +210,7 @@ int main(int aRgc, char **aRgv)
if(cmd.mVerboseLevel >= VERBOSE_INFO_OUTPUT) timer.start();
// Create the forest
Forest forest(cmd.mVerboseLevel);
Forest forest(cmd.mVerboseLevel/*, cmd.mOnlyInternalBranchFG*/);
// Enclose file loading into a block so temporary structures could be deleted when no more needed
{
......@@ -384,11 +376,11 @@ int main(int aRgc, char **aRgv)
std::cout << "(Doesn't pass LRT, skipping)";
std::cout << " Function calls: " << h0.getNumEvaluations() << " ";
std::cout << std::endl << std::endl;
if(lnl0 != std::numeric_limits<double>::infinity())
{
std::string s0 = h0.printFinalVars(std::cout);
//std::cout<<"EDW0: "<< s0 <<std::endl;
output_results.saveParameters(fg_branch, s0, 0);
if(lnl0 != std::numeric_limits<double>::infinity())
{
std::string s0 = h0.printFinalVars(std::cout);
//std::cout<<"EDW0: "<< s0 <<std::endl;
output_results.saveParameters(fg_branch, s0, 0);
}
std::cout << std::endl;
}
......@@ -401,11 +393,11 @@ int main(int aRgc, char **aRgv)
std::cout << std::setprecision(15) << std::fixed << lnl1;
std::cout << " Function calls: " << h1.getNumEvaluations();
std::cout << std::endl << std::endl;
if(lnl1 != std::numeric_limits<double>::infinity())
{
std::string s1= h1.printFinalVars(std::cout);
//std::cout<<"EDW1: "<< s1 <<std::endl;
output_results.saveParameters(fg_branch, s1, 1);
if(lnl1 != std::numeric_limits<double>::infinity())
{
std::string s1= h1.printFinalVars(std::cout);
//std::cout<<"EDW1: "<< s1 <<std::endl;
output_results.saveParameters(fg_branch, s1, 1);
}
std::cout << std::endl;
}
......@@ -601,8 +593,11 @@ Usage:
-r --trace (no argument)
Trace the maximization run
-nt --number-of-threads (required argument)
Number of threads (1 for non parallel execution)
-nt --number-of-threads (required argument)
Number of threads (1 for non parallel execution)
-np --no-parallel (no argument)
Don't use parallel execution
-bf --branch-from-file (no argument)
Do only the branch marked in the file as foreground branch
......@@ -641,9 +636,9 @@ Usage:
Don't stop H0 maximization even if it cannot satisfy LRT (default: stop)
-mi --max-iterations (required argument)
Maximum number of iterations for the maximizer (default: 10000)
-bl --branch-lengths-fixed (no argument)
Maximum number of iterations for the maximizer (default: 10000)
-bl --branch-lengths-fixed (no argument)
The length of the brances is fixed
@endverbatim
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment