int main(int argc, char *argv[]) { int nrT = atoi(argv[1]); omp_set_num_threads(nrT); printf("Rodando a %d ThRead\n", nrT); tempo1(); inicializa_vetor(); int i, aux; #pragma omp for private (i) for (i = 1; i < TAM; i++) { aux = vetor[i]; //printf("\n Valor %d", aux); int auxThRead = aux * nrT / TAM; //printf("\n Vetor Indice %d", auxThRead); vetorAux[auxThRead][maxVetor[auxThRead]] = aux; maxVetor[auxThRead]++; } { organiza(); } tempo2(); tempoFinal("mili segundos", argv[0], MSGLOG, argv[1]); /* mostra_vetor(); */ }
/* Conta o número de linhas do arquivo lista.txt em /config, ou seja, o número de imagens novas */ int contalinhas(){ int nimagens=0, nmaterias=0; FILE *sfp; char linhas[3]; char buff[256]; // arquivo lista.txt sfp = popen("wc -l config/lista.txt", "r"); fgets(buff, sizeof(buff), sfp); strncpy(linhas, buff, 2); linhas[2]='\0'; nimagens=atoi(linhas); // arquivo materias.txt sfp = popen("wc -l config/materias.txt", "r"); fgets(buff, sizeof(buff), sfp); strncpy(linhas, buff, 2); linhas[2]='\0'; nmaterias=atoi(linhas); organiza(nimagens, nmaterias); }