Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C Segmentation Fault Pthreads

Name: Anonymous 2018-01-02 18:23

I'm performing square matrix multiplications. The matrices are loaded from a text file named matrices.datomly For small matrices like 5x5 sometimes it works, sometimes it doesn't, this error appears randomly, but for larger files like 100x100 it always says segmentation fault 'core' dumped. Also tried mutexes but still the same error.

Code:
/*
USAGE:
./fine <numThreads>
*/

//Standard libraries for C
#include <stdio.h>
#include <stdlib.h>


//Thread library, to create and manipulate threads
#include <pthread.h>


//Time library, to use a method to calculate execution time
#include <sys/time.h>




//pthread_mutex_t mymutex;


int matrixSize;//All matrices will be square
int NUM_THREADS; //Number of threads to be created
int nmats;//Number of pairs of matrices
int myIndex;//Index for the array of structures
struct matrix{

Name: Anonymous 2018-01-02 22:46

>>4
Ubuntu Forums in this case.
people
It's one idiot who thinks he's absolutely epic and hilarious.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List