schedule options for force kernels and to print in main fn
Signed-off-by: TejeshPala <tejesh.pala@fau.de>
This commit is contained in:
		@@ -41,7 +41,7 @@ double computeForceLJFullNeigh_plain_c(Parameter *param, Atom *atom, Neighbor *n
 | 
			
		||||
    {
 | 
			
		||||
    LIKWID_MARKER_START("force");
 | 
			
		||||
 | 
			
		||||
    #pragma omp for
 | 
			
		||||
    #pragma omp for schedule(runtime)
 | 
			
		||||
    for(int i = 0; i < Nlocal; i++) {
 | 
			
		||||
        neighs = &neighbor->neighbors[i * neighbor->maxneighs];
 | 
			
		||||
        int numneighs = neighbor->numneigh[i];
 | 
			
		||||
@@ -131,7 +131,7 @@ double computeForceLJHalfNeigh(Parameter *param, Atom *atom, Neighbor *neighbor,
 | 
			
		||||
    {
 | 
			
		||||
    LIKWID_MARKER_START("forceLJ-halfneigh");
 | 
			
		||||
 | 
			
		||||
    #pragma omp for
 | 
			
		||||
    #pragma omp for schedule(runtime)
 | 
			
		||||
    for(int i = 0; i < Nlocal; i++) {
 | 
			
		||||
        neighs = &neighbor->neighbors[i * neighbor->maxneighs];
 | 
			
		||||
        int numneighs = neighbor->numneigh[i];
 | 
			
		||||
@@ -227,7 +227,7 @@ double computeForceLJFullNeigh_simd(Parameter *param, Atom *atom, Neighbor *neig
 | 
			
		||||
    {
 | 
			
		||||
    LIKWID_MARKER_START("force");
 | 
			
		||||
 | 
			
		||||
    #pragma omp for
 | 
			
		||||
    #pragma omp for schedule(runtime)
 | 
			
		||||
    for(int i = 0; i < Nlocal; i++) {
 | 
			
		||||
        neighs = &neighbor->neighbors[i * neighbor->maxneighs];
 | 
			
		||||
        int numneighs = neighbor->numneigh[i];
 | 
			
		||||
 
 | 
			
		||||
@@ -295,13 +295,28 @@ int main(int argc, char** argv) {
 | 
			
		||||
    printf(HLINE);
 | 
			
		||||
 | 
			
		||||
    int nthreads = 0;
 | 
			
		||||
    int chunkSize = 0;
 | 
			
		||||
    omp_sched_t schedKind;
 | 
			
		||||
    char schedType[10];
 | 
			
		||||
#pragma omp parallel
 | 
			
		||||
#pragma omp master
 | 
			
		||||
    {
 | 
			
		||||
    	nthreads = omp_get_num_threads();
 | 
			
		||||
    	omp_get_schedule(&schedKind, &chunkSize);
 | 
			
		||||
 | 
			
		||||
    	switch (schedKind)
 | 
			
		||||
    	{
 | 
			
		||||
        	case omp_sched_static:  strcpy(schedType, "static"); break;
 | 
			
		||||
        	case omp_sched_dynamic: strcpy(schedType, "dynamic"); break;
 | 
			
		||||
        	case omp_sched_guided:  strcpy(schedType, "guided"); break;
 | 
			
		||||
        	case omp_sched_auto:    strcpy(schedType, "auto"); break;
 | 
			
		||||
    	}
 | 
			
		||||
	
 | 
			
		||||
	nthreads = omp_get_num_threads();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    printf("Num threads: %d\n", nthreads);
 | 
			
		||||
 | 
			
		||||
    printf("Schedule: (%s,%d)\n", schedType, chunkSize);
 | 
			
		||||
    
 | 
			
		||||
    printf("Performance: %.2f million atom updates per second\n",
 | 
			
		||||
            1e-6 * (double) atom.Natoms * param.ntimes / timer[TOTAL]);
 | 
			
		||||
#ifdef COMPUTE_STATS
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user