<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'>Dear Andreas,<div><br></div><div>My OpenMP implementation perform the MP just using pragma directives, so if the -fopenmp flag is not set, the compiler will just ignore these lines and it will perform a single processor build. I checked both builds with gcc. We would be in a different situation if I had used OpenMP API calls. In fact, the #include&lt;omp.h&gt; I included in my patch it is not necessary at all (sorry). This way, the MP or sequential build just depends on the use of the -fopenmp flag.</div><div><br></div><div>Keep in mind that this flag differs between compilares (e.g, -openmp for icc, -mp for openUH, etc.) if you want to bring support for different compilers in the autoconf file.</div><div><br></div><div>Kind regards,</div><div><br></div><div>Diego.<br><br><hr id="zwchr"><b>De: </b>"Andreas Tille" &lt;andreas@an3as.eu&gt;<br><b>Para: </b>"Diego Darriba" &lt;ddarriba@udc.es&gt;<br><b>CC: </b>"s guindon" &lt;s.guindon@auckland.ac.nz&gt;, "Stephane Guindon" &lt;guindon@stat.auckland.ac.nz&gt;, "Olivier Gascuel" &lt;gascuel@lirmm.fr&gt;, "Jean-Francois Dufayard" &lt;jeanfrancois.dufayard@gmail.com&gt;, "David Posada" &lt;dposada@uvigo.es&gt;, "Debian Med Packaging Team" &lt;debian-med-packaging@lists.alioth.debian.org&gt;<br><b>Enviados: </b>Martes, 15 de Febrero 2011 21:25:51<br><b>Asunto: </b>Re: MP patch for PhyML<br><br>Dear Diego,<br><br>I admit I have no experience with MP builds but I wonder whether you<br>should not include the changes into #ifdef USEMP / #else / #endif<br>statements to enable both - single processor and MP builds. &nbsp;Or does the<br>patch work with both and it is just the build option which controls<br>everything?<br><br>Kind regards<br><br>&nbsp;&nbsp; &nbsp; Andreas.<br><br>On Tue, Feb 15, 2011 at 06:58:19PM +0100, Diego Darriba wrote:<br>&gt; Dear Stephan et al,<br>&gt;<br>&gt; I send you the patch for the current phyml trunk. I checked the results &nbsp;<br>&gt; with several input data, and I think I solved correctly some &nbsp;<br>&gt; dependencies in the parallelized loops from my computer science point of &nbsp;<br>&gt; view. In the configure.ac it is just necessary to include the *-fopenmp* &nbsp;<br>&gt; flag for compiling (if using gcc compiler). I would modify it, but I &nbsp;<br>&gt; prefer you to do so. That way you can create a conditional Makefile, or &nbsp;<br>&gt; include the flag as a commentary, or whatever.<br>&gt;<br>&gt; If the compilation flag is not set, the application will compile with no &nbsp;<br>&gt; error, but it will run as before (i.e, sequentially).<br>&gt;<br>&gt; Please, let me know if you have any doubt or any problem.<br>&gt;<br>&gt; Kind Regards,<br>&gt;<br>&gt; Diego.<br>&gt;<br>&gt; El 15/02/11 02:51, Stephane Guindon escribió:<br>&gt;&gt; Dear Andreas,<br>&gt;&gt;<br>&gt;&gt; Thank you very much for contributing to PhyML.<br>&gt;&gt; Yes, it makes perfect sense to try and include this functionality<br>&gt;&gt; into the latest release of the program. Please feel free to take<br>&gt;&gt; a look at the most recent version of the sources on our svn server<br>&gt;&gt; (http://code.google.com/p/phyml/source/browse/#svn%2Ftrunk%2Fsrc)<br>&gt;&gt; and let me know how to amend the configure.ac, *.c &nbsp;and *.h file<br>&gt;&gt; in an appropriate manner.<br>&gt;&gt;<br>&gt;&gt; Regards,<br>&gt;&gt;<br>&gt;&gt; -Stephane-<br>&gt;&gt;<br>&gt;&gt; On 15/02/11 03:26, Andreas Tille wrote:<br>&gt;&gt;&gt; Hi PhyML authors,<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; when discssing with Diego about a program which uses PhyML he told me<br>&gt;&gt;&gt; about his MP patch which would enable making use of hybrid memory when<br>&gt;&gt;&gt; running PhyML on clusters. &nbsp;I was considering to port this patch to the<br>&gt;&gt;&gt; Debian packaged version where I intended to support two versions of<br>&gt;&gt;&gt; the package: one conventional phylip and one phylip-mp.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; When inspecting the patch I noticed that it was done against an older<br>&gt;&gt;&gt; version of PhyML (20100123). &nbsp;I would consider it a reasonable idea if<br>&gt;&gt;&gt; this patch would be included into the upstream version by just wrapping<br>&gt;&gt;&gt; it into "#ifdef"s properly to enable switching between both versions by<br>&gt;&gt;&gt; simply providing different options to make. &nbsp;If the patch would be taken<br>&gt;&gt;&gt; over into the official PhyML code this would simplify our work as<br>&gt;&gt;&gt; distributor (as well as Diego's work) and it might be of extra value for<br>&gt;&gt;&gt; other users.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; What do you think about this idea?<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; Kind regards<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;Andreas.<br>&gt;&gt;&gt;<br>&gt;<br><br>&gt; Index: src/lk.c<br>&gt; ===================================================================<br>&gt; --- src/lk.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(revisi??n: 582)<br>&gt; +++ src/lk.c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(copia de trabajo)<br>&gt; @@ -11,8 +11,8 @@<br>&gt; &nbsp;*/<br>&gt; &nbsp;<br>&gt; &nbsp;#include "lk.h"<br>&gt; +#include &lt;omp.h&gt;<br>&gt; &nbsp;<br>&gt; -<br>&gt; &nbsp;/* int &nbsp; &nbsp;LIM_SCALE; */<br>&gt; &nbsp;/* phydbl LIM_SCALE_VAL; */<br>&gt; &nbsp;/* phydbl BIG; */<br>&gt; @@ -320,8 +320,9 @@<br>&gt; &nbsp;<br>&gt; &nbsp;phydbl Lk(t_tree *tree)<br>&gt; &nbsp;{<br>&gt; - &nbsp;int br;<br>&gt; + &nbsp;int br, site;<br>&gt; &nbsp; &nbsp;int n_patterns;<br>&gt; + &nbsp;phydbl c_lnL;<br>&gt; &nbsp;<br>&gt; &nbsp; &nbsp;tree-&gt;old_lnL = tree-&gt;c_lnL;<br>&gt; &nbsp;<br>&gt; @@ -349,10 +350,17 @@<br>&gt; &nbsp;<br>&gt; &nbsp; &nbsp;tree-&gt;c_lnL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = .0;<br>&gt; &nbsp; &nbsp;tree-&gt;sum_min_sum_scale = .0;<br>&gt; - &nbsp;For(tree-&gt;curr_site,n_patterns)<br>&gt; +<br>&gt; + &nbsp;c_lnL = .0;<br>&gt; + &nbsp;#pragma omp parallel for reduction(+:c_lnL)<br>&gt; + &nbsp;For(site,n_patterns)<br>&gt; &nbsp; &nbsp; &nbsp;{<br>&gt; - &nbsp; &nbsp; &nbsp;if(tree-&gt;data-&gt;wght[tree-&gt;curr_site] &gt; SMALL) Lk_Core(tree-&gt;noeud[0]-&gt;b[0],tree);<br>&gt; + &nbsp; &nbsp; &nbsp;if(tree-&gt;data-&gt;wght[site] &gt; SMALL) {<br>&gt; + &nbsp; &nbsp; &nbsp; &nbsp;Lk_Core(tree-&gt;noeud[0]-&gt;b[0],tree,site);<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c_lnL += tree-&gt;c_lnL_sorted[site];<br>&gt; + &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp; &nbsp; &nbsp;}<br>&gt; + &nbsp; &nbsp;tree-&gt;c_lnL = c_lnL;<br>&gt; &nbsp;<br>&gt; &nbsp;/* &nbsp; Qksort(tree-&gt;c_lnL_sorted,NULL,0,n_patterns-1); */<br>&gt; &nbsp;<br>&gt; @@ -372,7 +380,8 @@<br>&gt; &nbsp;<br>&gt; &nbsp;phydbl Lk_At_Given_Edge(t_edge *b_fcus, t_tree *tree)<br>&gt; &nbsp;{<br>&gt; - &nbsp;int n_patterns;<br>&gt; + &nbsp;int n_patterns,site;<br>&gt; + &nbsp;phydbl c_lnL;<br>&gt; &nbsp; &nbsp;<br>&gt; &nbsp; &nbsp;n_patterns = tree-&gt;n_pattern;<br>&gt; &nbsp;<br>&gt; @@ -396,10 +405,17 @@<br>&gt; &nbsp;<br>&gt; &nbsp; &nbsp;tree-&gt;c_lnL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = .0;<br>&gt; &nbsp; &nbsp;tree-&gt;sum_min_sum_scale = .0;<br>&gt; - &nbsp;For(tree-&gt;curr_site,n_patterns)<br>&gt; +<br>&gt; + &nbsp;c_lnL = .0;<br>&gt; + &nbsp;#pragma omp parallel for reduction(+:c_lnL)<br>&gt; + &nbsp;For(site,n_patterns)<br>&gt; &nbsp; &nbsp; &nbsp;{<br>&gt; - &nbsp; &nbsp; &nbsp;if(tree-&gt;data-&gt;wght[tree-&gt;curr_site] &gt; SMALL) Lk_Core(b_fcus,tree);<br>&gt; + &nbsp; &nbsp; &nbsp;if(tree-&gt;data-&gt;wght[site] &gt; SMALL) {<br>&gt; + &nbsp; &nbsp; &nbsp; &nbsp;Lk_Core(b_fcus,tree,site);<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c_lnL += tree-&gt;c_lnL_sorted[site];<br>&gt; + &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp; &nbsp; &nbsp;}<br>&gt; + &nbsp; &nbsp;tree-&gt;c_lnL = c_lnL;<br>&gt; &nbsp;<br>&gt; &nbsp;/* &nbsp; Qksort(tree-&gt;c_lnL_sorted,NULL,0,n_patterns-1); */<br>&gt; &nbsp;<br>&gt; @@ -422,7 +438,7 @@<br>&gt; &nbsp;<br>&gt; &nbsp;#ifndef USE_OLD_LK<br>&gt; &nbsp;<br>&gt; -phydbl Lk_Core(t_edge *b, t_tree *tree)<br>&gt; +phydbl Lk_Core(t_edge *b, t_tree *tree, int site)<br>&gt; &nbsp;{<br>&gt; &nbsp; &nbsp;phydbl log_site_lk;<br>&gt; &nbsp; &nbsp;phydbl site_lk_cat, site_lk;<br>&gt; @@ -431,7 +447,7 @@<br>&gt; &nbsp; &nbsp;phydbl max_sum_scale;<br>&gt; &nbsp; &nbsp;phydbl sum;<br>&gt; &nbsp; &nbsp;int ambiguity_check,state;<br>&gt; - &nbsp;int catg,ns,k,l,site;<br>&gt; + &nbsp;int catg,ns,k,l;<br>&gt; &nbsp; &nbsp;int dim1,dim2,dim3;<br>&gt; &nbsp; &nbsp;int *sum_scale_left_cat,*sum_scale_rght_cat;<br>&gt; &nbsp; &nbsp;phydbl multiplier;<br>&gt; @@ -439,6 +455,7 @@<br>&gt; &nbsp; &nbsp;phydbl tmp;<br>&gt; &nbsp; &nbsp;phydbl logbig;<br>&gt; &nbsp; &nbsp;phydbl inv_site_lk;<br>&gt; + &nbsp;phydbl tree_site_lk_cat[tree-&gt;mod-&gt;n_catg];<br>&gt; &nbsp;<br>&gt; &nbsp; &nbsp;logbig = LOG((phydbl)BIG);<br>&gt; &nbsp;<br>&gt; @@ -451,7 +468,6 @@<br>&gt; &nbsp; &nbsp;site_lk_cat &nbsp; &nbsp; = .0;<br>&gt; &nbsp; &nbsp;ambiguity_check = -1;<br>&gt; &nbsp; &nbsp;state &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = -1;<br>&gt; - &nbsp;site &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= tree-&gt;curr_site;<br>&gt; &nbsp; &nbsp;ns &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= tree-&gt;mod-&gt;ns;<br>&gt; &nbsp;<br>&gt; &nbsp; &nbsp;if((b-&gt;rght-&gt;tax) &amp;&amp; (!tree-&gt;mod-&gt;s_opt-&gt;greedy))<br>&gt; @@ -537,7 +553,7 @@<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&gt; - &nbsp; &nbsp; &nbsp;tree-&gt;site_lk_cat[catg] = site_lk_cat;<br>&gt; + &nbsp; &nbsp; &nbsp;tree_site_lk_cat[catg] = site_lk_cat;<br>&gt; &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp; &nbsp; &nbsp;<br>&gt; &nbsp; &nbsp;max_sum_scale = &nbsp;(phydbl)BIG;<br>&gt; @@ -562,7 +578,7 @@<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;Warn_And_Exit("\n");<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&gt; &nbsp;<br>&gt; - &nbsp; &nbsp; &nbsp;tmp = sum + (logbig - LOG(tree-&gt;site_lk_cat[catg]))/(phydbl)LOG2;<br>&gt; + &nbsp; &nbsp; &nbsp;tmp = sum + (logbig - LOG(tree_site_lk_cat[catg]))/(phydbl)LOG2;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;if(tmp &lt; max_sum_scale) max_sum_scale = tmp; /* min of the maxs */<br>&gt; &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp;<br>&gt; @@ -575,7 +591,7 @@<br>&gt; &nbsp; &nbsp; &nbsp;{<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;exponent = -(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale;<br>&gt; &nbsp;<br>&gt; - &nbsp; &nbsp; &nbsp;site_lk_cat = tree-&gt;site_lk_cat[catg];<br>&gt; + &nbsp; &nbsp; &nbsp;site_lk_cat = tree_site_lk_cat[catg];<br>&gt; &nbsp; &nbsp; &nbsp; <br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;if(exponent &gt; 0)<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>&gt; @@ -605,12 +621,12 @@<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;PhyML_Printf("\n+ site=%4d cat=%4d site_lk_cat=%G sum_scale=%d max=%G fact=%d expo=%d dbl=%G",<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; tree-&gt;curr_site,<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; catg,<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; tree-&gt;site_lk_cat[catg],<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; tree_site_lk_cat[catg],<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; sum_scale_left_cat[catg]+sum_scale_rght_cat[catg],<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; max_sum_scale,<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; fact_sum_scale,<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; -(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale,<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; (double)tree-&gt;site_lk_cat[catg] * pow(2.,-(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale));<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; (double)tree_site_lk_cat[catg] * pow(2.,-(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale));<br>&gt; &nbsp;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;site_lk_cat = BIG / 10;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&gt; @@ -623,12 +639,12 @@<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;PhyML_Printf("\n- site=%4d cat=%4d site_lk_cat=%G sum_scale=%d max=%G fact=%d expo=%d dbl=%G",<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; tree-&gt;curr_site,<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; catg,<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; tree-&gt;site_lk_cat[catg],<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; tree_site_lk_cat[catg],<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; sum_scale_left_cat[catg]+sum_scale_rght_cat[catg],<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; max_sum_scale,<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; fact_sum_scale,<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; -(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale,<br>&gt; -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; (double)tree-&gt;site_lk_cat[catg] * pow(2.,-(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale));<br>&gt; +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; (double)tree_site_lk_cat[catg] * pow(2.,-(sum_scale_left_cat[catg]+sum_scale_rght_cat[catg])+fact_sum_scale));<br>&gt; &nbsp;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Exit("\n");<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;}<br>&gt; @@ -636,13 +652,13 @@<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;site_lk_cat = .0;<br>&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&gt; &nbsp;<br>&gt; - &nbsp; &nbsp; &nbsp;tree-&gt;site_lk_cat[catg] = site_lk_cat;<br>&gt; + &nbsp; &nbsp; &nbsp;tree_site_lk_cat[catg] = site_lk_cat;<br>&gt; &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp;<br>&gt; &nbsp; &nbsp;site_lk = .0;<br>&gt; &nbsp; &nbsp;For(catg,tree-&gt;mod-&gt;n_catg)<br>&gt; &nbsp; &nbsp; &nbsp;{<br>&gt; - &nbsp; &nbsp; &nbsp;site_lk += tree-&gt;site_lk_cat[catg] * tree-&gt;mod-&gt;gamma_r_proba[catg];<br>&gt; + &nbsp; &nbsp; &nbsp;site_lk += tree_site_lk_cat[catg] * tree-&gt;mod-&gt;gamma_r_proba[catg];<br>&gt; &nbsp; &nbsp; &nbsp;}<br>&gt; &nbsp;<br>&gt; &nbsp; &nbsp;/* The substitution model does include invariable sites */<br>&gt; @@ -677,7 +693,7 @@<br>&gt; &nbsp;<br>&gt; &nbsp; &nbsp;log_site_lk = LOG(site_lk) - (phydbl)LOG2 * fact_sum_scale;<br>&gt; &nbsp;<br>&gt; - &nbsp;For(catg,tree-&gt;mod-&gt;n_catg) tree-&gt;log_site_lk_cat[catg][site] = LOG(tree-&gt;site_lk_cat[catg]) - (phydbl)LOG2 * fact_sum_scale;<br>&gt; + &nbsp;For(catg,tree-&gt;mod-&gt;n_catg) tree-&gt;log_site_lk_cat[catg][site] = LOG(tree_site_lk_cat[catg]) - (phydbl)LOG2 * fact_sum_scale;<br>&gt; &nbsp; &nbsp;<br>&gt; &nbsp; &nbsp;if(isinf(log_site_lk) || isnan(log_site_lk))<br>&gt; &nbsp; &nbsp; &nbsp;{<br>&gt; @@ -694,7 +710,6 @@<br>&gt; &nbsp; &nbsp;/* Multiply log likelihood by the number of times this site pattern is found in the data */<br>&gt; &nbsp; &nbsp;tree-&gt;c_lnL_sorted[site] = tree-&gt;data-&gt;wght[site]*log_site_lk;<br>&gt; &nbsp;<br>&gt; - &nbsp;tree-&gt;c_lnL += tree-&gt;data-&gt;wght[site]*log_site_lk;<br>&gt; &nbsp;/* &nbsp; tree-&gt;sum_min_sum_scale += (int)tree-&gt;data-&gt;wght[site]*min_sum_scale; */<br>&gt; &nbsp; &nbsp;<br>&gt; &nbsp; &nbsp;return log_site_lk;<br>&gt; @@ -1118,6 +1133,7 @@<br>&gt; &nbsp; &nbsp;Pij2 = d-&gt;b[dir2]-&gt;Pij_rr;<br>&gt; &nbsp; &nbsp;<br>&gt; &nbsp; &nbsp;/* For every site in the alignment */<br>&gt; + &nbsp;#pragma omp parallel for private(state_v1,state_v2,ambiguity_check_v1,ambiguity_check_v2,catg,i,p1_lk1,p2_lk2) <br>&gt; &nbsp; &nbsp;For(site,n_patterns)<br>&gt; &nbsp; &nbsp; &nbsp;{<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;state_v1 = state_v2 = -1;<br>&gt; @@ -1399,6 +1415,7 @@<br>&gt; &nbsp; &nbsp;Pij2 = d-&gt;b[dir2]-&gt;Pij_rr;<br>&gt; &nbsp; &nbsp;<br>&gt; &nbsp; &nbsp;/* For every site in the alignment */<br>&gt; + &nbsp;#pragma omp parallel for private(state_v1,state_v2,ambiguity_check_v1,ambiguity_check_v2,catg,i,p1_lk1,p2_lk2) <br>&gt; &nbsp; &nbsp;For(site,n_patterns)<br>&gt; &nbsp; &nbsp; &nbsp;{<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;state_v1 = state_v2 = -1;<br>&gt; @@ -2234,13 +2251,13 @@<br>&gt; &nbsp; &nbsp; sides of t_edge *b are up-to-date. Calculate the log-likelihood at one site.<br>&gt; &nbsp;*/<br>&gt; &nbsp;#ifdef USE_OLD_LK<br>&gt; -phydbl Lk_Core(t_edge *b, t_tree *tree)<br>&gt; +phydbl Lk_Core(t_edge *b, t_tree *tree, int site)<br>&gt; &nbsp;{<br>&gt; &nbsp; &nbsp;phydbl log_site_lk, site_lk, site_lk_cat;<br>&gt; &nbsp; &nbsp;phydbl scale_left, scale_rght;<br>&gt; &nbsp; &nbsp;phydbl sum;<br>&gt; &nbsp; &nbsp;int ambiguity_check,state;<br>&gt; - &nbsp;int catg,ns,k,l,site;<br>&gt; + &nbsp;int catg,ns,k,l;<br>&gt; &nbsp; &nbsp;int dim1,dim2,dim3;<br>&gt; &nbsp;<br>&gt; &nbsp;<br>&gt; @@ -2253,7 +2270,6 @@<br>&gt; &nbsp; &nbsp;site_lk_cat &nbsp; &nbsp; = .0;<br>&gt; &nbsp; &nbsp;ambiguity_check = -1;<br>&gt; &nbsp; &nbsp;state &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = -1;<br>&gt; - &nbsp;site &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= tree-&gt;curr_site;<br>&gt; &nbsp; &nbsp;ns &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= tree-&gt;mod-&gt;ns;<br>&gt; &nbsp;<br>&gt; &nbsp; &nbsp;tree-&gt;old_site_lk[site] = tree-&gt;cur_site_lk[site];<br>&gt; @@ -2383,7 +2399,7 @@<br>&gt; &nbsp; &nbsp;tree-&gt;cur_site_lk[site] = log_site_lk;<br>&gt; &nbsp; &nbsp;/* Multiply log likelihood by the number of times this site pattern is found oin the data */<br>&gt; &nbsp; &nbsp;tree-&gt;c_lnL_sorted[site] = tree-&gt;data-&gt;wght[site]*log_site_lk;<br>&gt; - &nbsp;tree-&gt;c_lnL += tree-&gt;c_lnL_sorted[site];<br>&gt; +<br>&gt; &nbsp; &nbsp;return log_site_lk;<br>&gt; &nbsp;}<br>&gt; &nbsp;<br>&gt; @@ -2492,6 +2508,7 @@<br>&gt; &nbsp; &nbsp;Pij2 = d-&gt;b[dir2]-&gt;Pij_rr;<br>&gt; &nbsp; &nbsp;<br>&gt; &nbsp; &nbsp;/* For every site in the alignment */<br>&gt; + &nbsp;#pragma omp parallel for private(scale_v1,scale_v2,state_v1,state_v2,ambiguity_check_v1,ambiguity_check_v2,catg,i,j,p1_lk1,p2_lk2,max_p_lk) <br>&gt; &nbsp; &nbsp;For(site,n_patterns)<br>&gt; &nbsp; &nbsp; &nbsp;{<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp;/* Current scaling values at that site */<br>&gt; Index: src/lk.h<br>&gt; ===================================================================<br>&gt; --- src/lk.h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(revisi??n: 582)<br>&gt; +++ src/lk.h&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(copia de trabajo)<br>&gt; @@ -51,7 +51,7 @@<br>&gt; &nbsp;phydbl Update_Lk_At_Given_Edge(t_edge *b_fcus, t_tree *tree);<br>&gt; &nbsp;void Update_P_Lk_Greedy(t_tree *tree, t_edge *b_fcus, t_node *n);<br>&gt; &nbsp;void Get_All_Partial_Lk_Scale_Greedy(t_tree *tree, t_edge *b_fcus, t_node *a, t_node *d);<br>&gt; -phydbl Lk_Core(t_edge *b, t_tree *tree);<br>&gt; +phydbl Lk_Core(t_edge *b, t_tree *tree, int site);<br>&gt; &nbsp;phydbl Lk_Triplet(t_node *a, t_node *d, t_tree *tree);<br>&gt; &nbsp;void Print_Lk_Given_Edge_Recurr(t_node *a, t_node *d, t_edge *b, t_tree *tree);<br>&gt; &nbsp;phydbl *Post_Prob_Rates_At_Given_Edge(t_edge *b, phydbl *post_prob, t_tree *tree);<br><br><br>-- <br>http://fam-tille.de<br></div></div></body></html>