Commit 93437d2c authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 1.6.11+dfsg

parent 48b7c97f
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ add_definitions(-DIQ_TREE)
# The version number.
set (iqtree_VERSION_MAJOR 1)
set (iqtree_VERSION_MINOR 6)
set (iqtree_VERSION_PATCH "9")
set (iqtree_VERSION_PATCH "11")

set(BUILD_SHARED_LIBS OFF)

@@ -277,9 +277,14 @@ if (NOT IQTREE_FLAGS MATCHES "single")
		set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
  		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -pthread")
  	elseif (CLANG)
        if (APPLE)
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xpreprocessor -fopenmp -pthread")
            set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Xpreprocessor -fopenmp -lomp")
        else()
            set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
  		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp=libomp -pthread")
        set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fopenmp=libomp")
            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -pthread")
        endif()
  	endif()
else()
	message("OpenMP        : NONE")
@@ -509,12 +514,10 @@ add_library(kernelfma tree/phylokernelfma.cpp)
    endif()
endif()

if (IQTREE_FLAGS MATCHES "mpi")
	add_library(mympi utils/TreeCollection.cpp utils/ObjectStream.cpp)
endif()

if (NOT IQTREE_FLAGS MATCHES "single")
    if (BINARY32)
    if (APPLE)
        link_directories(${PROJECT_SOURCE_DIR}/libmac)
    elseif (BINARY32)
        link_directories(${PROJECT_SOURCE_DIR}/lib32)
    else()
        link_directories(${PROJECT_SOURCE_DIR}/lib)
@@ -602,7 +605,6 @@ endif()

# MPI libraries
if (IQTREE_FLAGS MATCHES "mpi")
    target_link_libraries(iqtree mympi)
    if (NOT CMAKE_CXX_COMPILER MATCHES "mpi")
        target_link_libraries(iqtree ${MPI_CXX_LIBRARIES})
    endif()
+17 −5
Original line number Diff line number Diff line
@@ -2943,14 +2943,23 @@ void convert_range(const char *str, int &lower, int &upper, int &step_size, char
    if (*endptr != '-') return;

    // parse the upper bound of the range
    str = endptr+1;
    endptr++;
    // skip blank chars
    for (; *endptr == ' '; endptr++) {}
    str = endptr;
    d = strtol(str, &endptr, 10);
    if ((d == 0 && endptr == str) || abs(d) == HUGE_VALL) {
        if (str[0] == '.') {
            // 2019-06-03: special character '.' for whatever ending position
            d = lower-1;
            endptr++;
        } else {
            string err = "Expecting integer, but found \"";
            err += str;
            err += "\" instead";
            throw err;
        }
    }

    //lower = d_save;
    upper = d;
@@ -2982,6 +2991,9 @@ void extractSiteID(Alignment *aln, const char* spec, IntVector &site_id) {
        for (; *str != 0; ) {
            int lower, upper, step;
            convert_range(str, lower, upper, step, str);
            // 2019-06-03: special '.' character
            if (upper == lower-1)
                upper = aln->getNSite();
            lower--;
            upper--;
            nchars += (upper-lower+1)/step;
+1 −0
Original line number Diff line number Diff line
@@ -935,6 +935,7 @@ void SuperAlignment::createBootstrapAlignment(Alignment *aln, IntVector* pattern
                    auto site_pattern = boot_aln->site_pattern;
                    for (int j = 1; j < gene_freq[i]; j++)
                        boot_aln->site_pattern.insert(boot_aln->site_pattern.end(), site_pattern.begin(), site_pattern.end());
                    boot_aln->countConstSite();
                }
                partitions.push_back(boot_aln);
            }
+28 −49
Original line number Diff line number Diff line
@@ -68,9 +68,6 @@
#include "vectorclass/instrset.h"

#include "utils/MPIHelper.h"
#ifdef _IQTREE_MPI
#include <mpi.h>
#endif

#ifdef _OPENMP
	#include <omp.h>
@@ -1721,6 +1718,7 @@ void processNCBITree(Params &params) {
class outstreambuf : public streambuf {
public:
    outstreambuf* open( const char* name, ios::openmode mode = ios::out);
    bool is_open();
    outstreambuf* close();
    ~outstreambuf() { close(); }
    streambuf *get_fout_buf() {
@@ -1753,6 +1751,10 @@ outstreambuf* outstreambuf::open( const char* name, ios::openmode mode) {
    return this;
}

bool outstreambuf::is_open() {
    return fout.is_open();
}

outstreambuf* outstreambuf::close() {
    cout.rdbuf(cout_buf);
    if ( fout.is_open()) {
@@ -1850,8 +1852,8 @@ extern "C" void startLogFile(bool append_log) {
}

extern "C" void endLogFile() {
    if (_out_buf.is_open())
        _out_buf.close();
    
}

void funcExit(void) {
@@ -1862,6 +1864,7 @@ void funcExit(void) {
	}
	
    endLogFile();
    MPIHelper::getInstance().finalize();
}

extern "C" void funcAbort(int signal_number)
@@ -2218,20 +2221,9 @@ int main(int argc, char *argv[]) {
    */
    int instruction_set;

#ifdef _IQTREE_MPI
	double time_initial, time_current;
	int n_tasks, task_id;
	if (MPI_Init(&argc, &argv) != MPI_SUCCESS) {
		outError("MPI initialization failed!");
	}
	MPI_Comm_size(MPI_COMM_WORLD, &n_tasks);
	MPI_Comm_rank(MPI_COMM_WORLD, &task_id);
	MPIHelper::getInstance().setNumProcesses(n_tasks);
	MPIHelper::getInstance().setProcessID(task_id);
	MPIHelper::getInstance().setNumTreeReceived(0);
	MPIHelper::getInstance().setNumTreeSent(0);
    MPIHelper::getInstance().setNumNNISearch(0);
#endif
    MPIHelper::getInstance().init(argc, argv);
    
    atexit(funcExit);

	/*************************/
	{ /* local scope */
@@ -2289,17 +2281,22 @@ int main(int argc, char *argv[]) {
        if (checkpoint->hasKey("finished")) {
            if (checkpoint->getBool("finished")) {
                if (Params::getInstance().force_unfinished) {
                    if (MPIHelper::getInstance().isMaster())
                        cout << "NOTE: Continue analysis although a previous run already finished" << endl;
                } else {
                    delete checkpoint;
                    if (MPIHelper::getInstance().isMaster())
                        outError("Checkpoint (" + filename + ") indicates that a previous run successfully finished\n" +
                            "Use `-redo` option if you really want to redo the analysis and overwrite all output files.");
                    delete checkpoint;
                    return EXIT_FAILURE;
                    else
                        exit(EXIT_SUCCESS);
                    exit(EXIT_FAILURE);
                } 
            } else {
                append_log = true;
            }
        } else {
            if (MPIHelper::getInstance().isMaster())
                outWarning("Ignore invalid checkpoint file " + filename);
            checkpoint->clear();
        }
@@ -2318,25 +2315,9 @@ int main(int argc, char *argv[]) {
        cout << endl << "******************************************************"
             << endl << "CHECKPOINT: Resuming analysis from " << filename << endl << endl;
    }
#ifdef _IQTREE_MPI
	cout << "************************************************" << endl;
	cout << "* START TREE SEARCH USING MPI WITH " << MPIHelper::getInstance().getNumProcesses() << " PROCESSES *" << endl;
	cout << "************************************************" << endl;
	unsigned int rndSeed;
	if (MPIHelper::getInstance().isMaster()) {
		rndSeed = Params::getInstance().ran_seed;
		cout << "Random seed of master = " << rndSeed << endl;
	}
	// Broadcast random seed
	MPI_Bcast(&rndSeed, 1, MPI_INT, PROC_MASTER, MPI_COMM_WORLD);
	if (MPIHelper::getInstance().isWorker()) {
//		Params::getInstance().ran_seed = rndSeed + task_id * 100000;
		Params::getInstance().ran_seed = rndSeed;
//		printf("Process %d: random_seed = %d\n", task_id, Params::getInstance().ran_seed);
	}
#endif

	atexit(funcExit);
    MPIHelper::getInstance().syncRandomSeed();
    
    signal(SIGABRT, &funcAbort);
	signal(SIGFPE, &funcAbort);
	signal(SIGILL, &funcAbort);
@@ -2469,8 +2450,10 @@ int main(int argc, char *argv[]) {
	}
#endif

#ifdef _IQTREE_MPI
    cout << endl << "MPI:     " << MPIHelper::getInstance().getNumProcesses() << " processes";
#endif
    
#ifndef _IQTREE_MPI
    int num_procs = countPhysicalCPUCores();
#ifdef _OPENMP
    if (num_procs > 1 && Params::getInstance().num_threads == 1) {
@@ -2480,7 +2463,6 @@ int main(int argc, char *argv[]) {
#else
    if (num_procs > 1)
        cout << endl << endl << "NOTE: Consider using the multicore version because your CPU has " << num_procs << " cores!";
#endif
#endif

	//cout << "sizeof(int)=" << sizeof(int) << endl;
@@ -2638,8 +2620,5 @@ int main(int argc, char *argv[]) {

	finish_random();
    
#ifdef _IQTREE_MPI
    MPI_Finalize();
#endif    
	return EXIT_SUCCESS;
}
+8 −2
Original line number Diff line number Diff line
@@ -377,8 +377,14 @@ bool ModelDNA::setRateType(string rate_str) {
			cout << rates[i] << " ";
		cout << endl;
	}
    if (param_fixed.size() == num_params + 1) {
        num_params = 0;
        for (auto p : param_fixed)
            if (!p) num_params++;
    } else {
        param_fixed.resize(num_params+1, false);
        param_fixed[0] = true; // fix the last entry
    }
	delete [] num_rates;
	delete [] avg_rates;
	return true;
Loading