SlideShare a Scribd company logo
1 of 1
Download to read offline
Parallelize this section of code using omp
// TODO: parallelize the computations for each gene.
for (int gene_index = 0; gene_index < genes.num_genes; ++gene_index) {
// Compute this gene's TF
int* gene_TF = (int*)calloc(NUM_TETRANUCS, sizeof(int));
process_tetranucs(genes, gene_TF, gene_index);
// Add this gene's TF to the running total TF
for (int t = 0; t < NUM_TETRANUCS; ++t)
TF[t] += gene_TF[t];
free(gene_TF);
}
// 2) Get the averages of each TF (as a double!)
double* average_TF = (double*)malloc(NUM_TETRANUCS * sizeof(double));
for (int t = 0; t < NUM_TETRANUCS; ++t)
average_TF[t] = (double)TF[t] / (double)genes.num_genes;
a) omp critical
b) omp atomic
c) omp lock
NOTE: Do not use any other kind of parallelization technique beside omp

More Related Content

More from inforelipower

Por qu sera ms probable que Ganmedes albergara vida que.pdf
Por qu sera ms probable que Ganmedes albergara vida que.pdfPor qu sera ms probable que Ganmedes albergara vida que.pdf
Por qu sera ms probable que Ganmedes albergara vida que.pdf
inforelipower
 
Most everyone is familiar with Angry Birds the video game i.pdf
Most everyone is familiar with Angry Birds the video game i.pdfMost everyone is familiar with Angry Birds the video game i.pdf
Most everyone is familiar with Angry Birds the video game i.pdf
inforelipower
 
15 Como preparacin para su charla informativa sobre la imp.pdf
15 Como preparacin para su charla informativa sobre la imp.pdf15 Como preparacin para su charla informativa sobre la imp.pdf
15 Como preparacin para su charla informativa sobre la imp.pdf
inforelipower
 
Ltfen Muhasebe Bilgilerinin Temel Boyutlarnn Sermaye Kazan.pdf
Ltfen Muhasebe Bilgilerinin Temel Boyutlarnn Sermaye Kazan.pdfLtfen Muhasebe Bilgilerinin Temel Boyutlarnn Sermaye Kazan.pdf
Ltfen Muhasebe Bilgilerinin Temel Boyutlarnn Sermaye Kazan.pdf
inforelipower
 
Jane tiene quince aos Visit una tienda de comestibles es.pdf
Jane tiene quince aos Visit una tienda de comestibles es.pdfJane tiene quince aos Visit una tienda de comestibles es.pdf
Jane tiene quince aos Visit una tienda de comestibles es.pdf
inforelipower
 
Las patentes se analizan como parte de la fase de invencin .pdf
Las patentes se analizan como parte de la fase de invencin .pdfLas patentes se analizan como parte de la fase de invencin .pdf
Las patentes se analizan como parte de la fase de invencin .pdf
inforelipower
 
En enero de 2001 un hombre de Nueva York asisti a una fies.pdf
En enero de 2001 un hombre de Nueva York asisti a una fies.pdfEn enero de 2001 un hombre de Nueva York asisti a una fies.pdf
En enero de 2001 un hombre de Nueva York asisti a una fies.pdf
inforelipower
 

More from inforelipower (20)

Q3 a What are the duties of Agent b Peter would like to.pdf
Q3 a What are the duties of Agent b Peter would like to.pdfQ3 a What are the duties of Agent b Peter would like to.pdf
Q3 a What are the duties of Agent b Peter would like to.pdf
 
Por qu sera ms probable que Ganmedes albergara vida que.pdf
Por qu sera ms probable que Ganmedes albergara vida que.pdfPor qu sera ms probable que Ganmedes albergara vida que.pdf
Por qu sera ms probable que Ganmedes albergara vida que.pdf
 
Most everyone is familiar with Angry Birds the video game i.pdf
Most everyone is familiar with Angry Birds the video game i.pdfMost everyone is familiar with Angry Birds the video game i.pdf
Most everyone is familiar with Angry Birds the video game i.pdf
 
15 Como preparacin para su charla informativa sobre la imp.pdf
15 Como preparacin para su charla informativa sobre la imp.pdf15 Como preparacin para su charla informativa sobre la imp.pdf
15 Como preparacin para su charla informativa sobre la imp.pdf
 
Makaleyi oku Reiss Julian Aklama Paradoksu Journal of.pdf
Makaleyi oku Reiss Julian Aklama Paradoksu Journal of.pdfMakaleyi oku Reiss Julian Aklama Paradoksu Journal of.pdf
Makaleyi oku Reiss Julian Aklama Paradoksu Journal of.pdf
 
Ltfen Muhasebe Bilgilerinin Temel Boyutlarnn Sermaye Kazan.pdf
Ltfen Muhasebe Bilgilerinin Temel Boyutlarnn Sermaye Kazan.pdfLtfen Muhasebe Bilgilerinin Temel Boyutlarnn Sermaye Kazan.pdf
Ltfen Muhasebe Bilgilerinin Temel Boyutlarnn Sermaye Kazan.pdf
 
Kendi seslerini halka ak bir ekilde radyo zerinden ileten .pdf
Kendi seslerini halka ak bir ekilde radyo zerinden ileten .pdfKendi seslerini halka ak bir ekilde radyo zerinden ileten .pdf
Kendi seslerini halka ak bir ekilde radyo zerinden ileten .pdf
 
Jane tiene quince aos Visit una tienda de comestibles es.pdf
Jane tiene quince aos Visit una tienda de comestibles es.pdfJane tiene quince aos Visit una tienda de comestibles es.pdf
Jane tiene quince aos Visit una tienda de comestibles es.pdf
 
It is known that for independent Poisson distributed random .pdf
It is known that for independent Poisson distributed random .pdfIt is known that for independent Poisson distributed random .pdf
It is known that for independent Poisson distributed random .pdf
 
Mary y Sue trabajan en el mismo departamento Mary cree que .pdf
Mary y Sue trabajan en el mismo departamento Mary cree que .pdfMary y Sue trabajan en el mismo departamento Mary cree que .pdf
Mary y Sue trabajan en el mismo departamento Mary cree que .pdf
 
1Analyzing competitive opportunities and threats happens in.pdf
1Analyzing competitive opportunities and threats happens in.pdf1Analyzing competitive opportunities and threats happens in.pdf
1Analyzing competitive opportunities and threats happens in.pdf
 
Las patentes se analizan como parte de la fase de invencin .pdf
Las patentes se analizan como parte de la fase de invencin .pdfLas patentes se analizan como parte de la fase de invencin .pdf
Las patentes se analizan como parte de la fase de invencin .pdf
 
Cul de los siguientes factores es menos probable que afect.pdf
Cul de los siguientes factores es menos probable que afect.pdfCul de los siguientes factores es menos probable que afect.pdf
Cul de los siguientes factores es menos probable que afect.pdf
 
1 List and describe in your own words the required compon.pdf
1 List and describe in your own words the required compon.pdf1 List and describe in your own words the required compon.pdf
1 List and describe in your own words the required compon.pdf
 
Label the following in a Europe base map as much as possible.pdf
Label the following in a Europe base map as much as possible.pdfLabel the following in a Europe base map as much as possible.pdf
Label the following in a Europe base map as much as possible.pdf
 
Jeff sues Karen for breach of contract seeking 100000 in .pdf
Jeff sues Karen for breach of contract seeking 100000 in .pdfJeff sues Karen for breach of contract seeking 100000 in .pdf
Jeff sues Karen for breach of contract seeking 100000 in .pdf
 
EXPLAIN amp DEMONSTRATE how globalization does not necessa.pdf
EXPLAIN amp DEMONSTRATE how globalization does not necessa.pdfEXPLAIN amp DEMONSTRATE how globalization does not necessa.pdf
EXPLAIN amp DEMONSTRATE how globalization does not necessa.pdf
 
1 Identificar las fases del ciclo econmico y los problemas.pdf
1 Identificar las fases del ciclo econmico y los problemas.pdf1 Identificar las fases del ciclo econmico y los problemas.pdf
1 Identificar las fases del ciclo econmico y los problemas.pdf
 
Design a program with code in python to be able to calculate.pdf
Design a program with code in python to be able to calculate.pdfDesign a program with code in python to be able to calculate.pdf
Design a program with code in python to be able to calculate.pdf
 
En enero de 2001 un hombre de Nueva York asisti a una fies.pdf
En enero de 2001 un hombre de Nueva York asisti a una fies.pdfEn enero de 2001 un hombre de Nueva York asisti a una fies.pdf
En enero de 2001 un hombre de Nueva York asisti a una fies.pdf
 

Recently uploaded

會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 

Parallelize this section of code using omp TODO parallel.pdf

  • 1. Parallelize this section of code using omp // TODO: parallelize the computations for each gene. for (int gene_index = 0; gene_index < genes.num_genes; ++gene_index) { // Compute this gene's TF int* gene_TF = (int*)calloc(NUM_TETRANUCS, sizeof(int)); process_tetranucs(genes, gene_TF, gene_index); // Add this gene's TF to the running total TF for (int t = 0; t < NUM_TETRANUCS; ++t) TF[t] += gene_TF[t]; free(gene_TF); } // 2) Get the averages of each TF (as a double!) double* average_TF = (double*)malloc(NUM_TETRANUCS * sizeof(double)); for (int t = 0; t < NUM_TETRANUCS; ++t) average_TF[t] = (double)TF[t] / (double)genes.num_genes; a) omp critical b) omp atomic c) omp lock NOTE: Do not use any other kind of parallelization technique beside omp