Skip to content

Instantly share code, notes, and snippets.

@naumenko-sa
Last active November 1, 2019 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naumenko-sa/7c3ee0837b449576dec16c5e4fb28f81 to your computer and use it in GitHub Desktop.
Save naumenko-sa/7c3ee0837b449576dec16c5e4fb28f81 to your computer and use it in GitHub Desktop.

test:

#include <stdio.h>
#include <pthread.h>

#define NTHREADS 15
void *thread_function(void *);

int main()
{
    pthread_t thread_id[NTHREADS];
    int i, j;

    for(i=0; i < NTHREADS; i++)
    {
        pthread_create( &thread_id[i], NULL, thread_function, NULL );
    }

    for(j=0; j < NTHREADS; j++)
    {
        pthread_join( thread_id[j], NULL);
    }
    return 0;
}

void *thread_function(void *dummyPtr)
{
    int counter=0;
    for (int i=0;i<100000/NTHREADS;i++)
        for (int j=0;j<100000;j++)
            counter++;
}

compile on SCP: gcc -o test -lpthread test.c compile on AWS: gcc -o test -pthread test.c

run: time ./test

1 worker thread:

where real user
SCP64coreNUMA 27.683s 27.649s
AWS48core 21.901s 21.901s
Lenovo8core 20.031s 19.987s
O2 32core 27.506s 27.519s

15 worker threads:

where real user ratio
SCP64coreNUMA 6.909s 27.638s 4
AWS48core 2.227s 31.950s 14
Lenovo8core 4.854s 35.381s 7
O2 32core 27.682 27.646 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment