[Subject Prev][Subject Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hts-users:01875] Re: Fast & memory efficient HHEd clustering patch


Hi,

Heiga Zen (Byung Ha CHUN) wrote:

This patch code may have bugs.  Please test it and check whether it
works or not.  If you find any problems in this, please report them to
the hts-users ML.  I hope this modification improves the scalability of
HTS.  It is my pleasure that this patch code contributes the further
progress of both HTS itself and HTS community.

The attached patch code provides additional parallelization based on OpenMP to reduce the computational time while setting the Question x Model table. To turn on this parallelization, you need to compile it with a option for OpenMP. For gcc (>=4.1), please use -fopenmp option. Intel compiler also supports OpenMP (-openmp).

Best regards,

Heiga ZEN (Byung Ha CHUN)

--
--------------------------
Heiga ZEN (Byung Ha CHUN)
Speech Technology Group
Cambridge Research Lab
Toshiba Research Europe
phone: +44 1223 436975


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
--- HHEd.c	2009-01-06 11:04:53.970580000 +0000
+++ HHEd.c	2009-01-08 10:51:44.598671000 +0000
@@ -3456,11 +3456,11 @@
 void SetQMTable (void)
 {
    char *name;
-   int i,j;
+   int h,i,j;
    ILink p;
+   MLink m;
    Boolean answer;
    Question *q;
-   HMMScanState hss;
 
    const int size=(hset->numPhyHMM>>3)+1;
 
@@ -3471,22 +3471,25 @@
       memset(QMTable[i], 0, size);
    }
 
-   NewHMMScan(hset,&hss);
-   do {
-      /* index and name of current hmm */
-      i = hss.hmm->hIdx >> 3;  /* division by 8 */
-      j = hss.hmm->hIdx &  7;  /* residue by 8 */
-      name = hss.mac->id->name;
-
-      /* check answers */
-      for (p=qList; p!=NULL; p=p->next) {
-         q = (Question *)p->item;
-         answer = QMatch(name, q);
-         if (answer)
-            QMTable[q->index][i] |= (1<<j);  /* set j-th bit */
+#pragma omp parallel for private(name,h,i,j,p,m,answer,q)
+   for (h=0; h<MACHASHSIZE; h++) {
+      for (m=hset->mtab[h]; m!=NULL; m=m->next) {
+         if (m->type == 'h') {
+            /* index and name of current hmm */
+            i = ((HLink)(m->structure))->hIdx >> 3;  /* division by 8 */
+            j = ((HLink)(m->structure))->hIdx &  7;  /* residue by 8 */
+            name = m->id->name;
+
+            /* check answers */
+            for (p=qList; p!=NULL; p=p->next) {
+               q = (Question *)p->item;
+               answer = QMatch(name, q);
+               if (answer)
+                  QMTable[q->index][i] |= (1<<j);  /* set j-th bit */
+            }
+         }
       }
-   } while(GoNextHMM(&hss));
-   EndHMMScan(&hss);
+   }
 
    setQMTable = TRUE;
 

Follow-Ups
[hts-users:01903] Re: Fast & memory efficient HHEd clustering patch, Junichi Yamagishi
[hts-users:01933] Re: Fast & memory efficient HHEd clustering patch, 康世胤
[hts-users:02298] Re: Fast & memory efficient HHEd clustering patch, Heiga ZEN (Byung Ha CHUN)