Gcc openmp programming problem


 
Thread Tools Search this Thread
Top Forums Programming Gcc openmp programming problem
# 1  
Old 08-01-2014
Bug Gcc openmp programming problem

[solved]

Dear Linux users,
I'm a noob at openmp, gcc and c programming. I can run my own openmp code in terminal with no problem, eg. gcc -fopenmp program.c -o program.

But now I'm trying to compile and run another person's code, it contains a makefile and multiple .c and .h files. I don't know how to compile/run this?
Link to the files - https ://github.com/awreece/memory-bandwidth-demo

My attempt to make and run it:

Code:
linux@linux ~ $ make
gcc -O3 -march=native main.c monotonic_timer.c functions.c -o memory_profiler -fopenmp -DWITH_OPENMP

linux@linux ~ $ ./memory_profiler
           read_memory_rep_lodsq:  6.96 GiB/s
                read_memory_loop:  7.89 GiB/s
                 read_memory_sse:  7.79 GiB/s
               write_memory_loop:  6.58 GiB/s
          write_memory_rep_stosq:  7.28 GiB/s
                write_memory_sse:  6.61 GiB/s
    write_memory_nontemporal_sse:  5.86 GiB/s
             write_memory_memset:  6.64 GiB/s
memory_profiler: main.c:51: timeitp: Assertion `(1*(1024*1024*1024LL)) % omp_get_max_threads() == 0' failed.
Aborted

Program aborts half way when trying to run openmp code from main.c . I don't think I'm using openmp properly? How can I fix this?



Thankyou for your time,
pigeon

Moderator's Comments:
Mod Comment Please use code tags instead of italics, [code]stuff[/code]

Last edited by Corona688; 08-01-2014 at 12:44 PM.. Reason: solved
# 2  
Old 08-01-2014
You're compiling it correctly.

How many cores does your system have? The failing assert amounts to, "your system must have a power-of-2 number of cores". So 1, 2, 4, 8, ... cores would be okay -- 6 cores would not.

I don't know very much about OMP at all. I'm not sure whether this is referring to physical cores or just the number OMP is allowed to use in this context.
# 3  
Old 08-02-2014
Thanks for the reply. I needed to specify in the terminal how many cores I'm using. The code is now running properly Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Help with gcc programming

I need a lot of help with c programming. I have the source code. Running configure, I got one error message about a missing library. I downloaded and successfully compiled it in another dir. Do I throw all the new files into my source dir and run configure again ? Thanks. (3 Replies)
Discussion started by: drew77
3 Replies

2. Programming

Need help with counting within parallelized block - OpenMP/C-Programming

Hello together, I have a question for you. Since a few weeks I am trying to programm a small bruteforce application in C on Ubuntu 14.04.1 using Code::Blocks with gcc-4.8.2. My programm is nothing special. It's just for practise, Without hashing or something like that. For me the focus is on... (11 Replies)
Discussion started by: DaveX
11 Replies

3. Programming

gcc problem

Hi, I just try to solve the problem why one app failing on box1 and runs ok on box2, they have diff gcc version as I see from /proc/version: box1:: 3.4.1 box2:: 4.1.2 It's RedHat 64b boxes, so I can not run some <make all> command on box1, do you think I need to upgrade (if I'm using... (1 Reply)
Discussion started by: mario17
1 Replies

4. Solaris

gcc problem on Solaris

I just installed gcc from the latest package at sunfreeware.com using pkgadd. I write a simple 'Hello World!' program to test it. I try to compile it and I get this error: rockstar# gcc hello.c -o hello ld.so.1: gcc: fatal: libiconv.so.2: open failed: No such file or directory Killed I... (0 Replies)
Discussion started by: Bradj47
0 Replies

5. Red Hat

GCC version problem

I have a host PC and a target system . Host System -> gcc (3.2) Redhat linux kernel 2.4.20-8 , glibc 2.3 Target System -> gcc (4.1) Fedora linux kernel 2.6.18-1.2798.fc6, glibc 2.5 I would like to build test program that can be run on both systems --------------------------- ... (0 Replies)
Discussion started by: mugdha
0 Replies

6. Programming

XWindows programming + gcc linker options

Im trying to compile some code that involves using X-Windows based functions (XDisplayName() and XOpenDisplay() ), however each time I run the compiler, Im getting a problem with the linker. The linker says that both XDisplayName() and XOpenDisplay() are unresolved text symbols. Is there a... (1 Reply)
Discussion started by: JamesGoh
1 Replies

7. Solaris

gcc 3.4 Regex problem

Hello All, I have been using String.h with gcc 2.95. Now I have upgraded to gcc 3.4. The support for String.h has been removed and I believe Regex.h support is also not inbuilt. So I tried to build my own library for String.h. I had to use Regex.h and rx.h for a succesful library compilation.... (0 Replies)
Discussion started by: manishs13
0 Replies

8. Programming

A problem of GCC

Hi mates, I am a new comer of this forums. I have a problem while using function "fread(buffer, size, number, file-pointer)" to read a binary file. While I used the "fread()" to read the binary file under Solaris UNIX System, it worked very well. But it gets a incorrect result... (6 Replies)
Discussion started by: cquedugdylp
6 Replies

9. Programming

gcc Link problem

I have some crypting functions in object-file - for example,func.o Main file,from where crypting functions called, named as main.cpp . "gcc main.cpp -o main func.o" print "undefined reference to ... " But if I rename main.cpp to main.c and execute "gcc main.c -o main func.o" - ok. If anybody,... (3 Replies)
Discussion started by: Gigachel
3 Replies

10. UNIX for Dummies Questions & Answers

Problem installing gcc

Hi! I have downloaded a precompiled gcc package but I'm having problems installing it. It is supposed to install in /usr/local and there is plenty of space left there but during the installation I get the following error message “No space left on device”. Is it some kind of temp folder that is out... (2 Replies)
Discussion started by: alfabetman
2 Replies
Login or Register to Ask a Question