FAQ  •  Login

CMake Questions (Please post them here)

<<

HammadM

Supreme Overlord
Supreme Overlord

Posts: 37

Joined: Wed Sep 03, 2008 12:23 pm

Unread post Wed Sep 09, 2015 2:25 pm

CMake Questions (Please post them here)

Hi Everyone,

If you have any questions about CMake please post them here, it will make it easier to answer questions as there will be a single location to answer things.

I put an example on github of how to write/structure the cmake files:
https://github.com/uwsbel/me759_homework

on euler run this to set everything up:
notes:
the build directory (build_me759_homework/) is at the same level as the source directory
all executables are built to the bin directory

  Code:
git clone https://github.com/uwsbel/me759_homework.git
mkdir build_me759_homework
cd build_me759_homework
cmake ../me759_homework/
make
<<

timhaines

Newbie
Newbie

Posts: 34

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 09, 2015 3:04 pm

Re: CMake Questions (Please post them here)

cmake is currently (Wed Sep 9 20:03:53 UTC 2015) not working on Euler.

> cmake
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/home/thaines
Segmentation fault

EDIT: I tested this on another user's account and it is working fine there. The problem appears to be localized to my (or a few) accounts.
- Tim
<<

HammadM

Supreme Overlord
Supreme Overlord

Posts: 37

Joined: Wed Sep 03, 2008 12:23 pm

Unread post Wed Sep 09, 2015 3:28 pm

Re: CMake Questions (Please post them here)

Were you running it from the euler head node or through slurm on a different node?
I just ran it from your account and it seems to be working fine:
(I'm an admin on the cluster)

  Code:
[thaines@euler ~]$ cmake
cmake version 2.8.11
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>
...
<<

timhaines

Newbie
Newbie

Posts: 34

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 09, 2015 3:37 pm

Re: CMake Questions (Please post them here)

I ran it from the head node. I just tried it again, and it is working now. Transient bugs are the best bugs!
- Tim
<<

kema

Newbie
Newbie

Posts: 41

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 09, 2015 4:17 pm

Re: CMake Questions (Please post them here)

What do we need to submit for each assignment? Only CMakeLists.txt and the source files in homework_0x folder as well as a readme.pdf?
<<

nirvedhmeshram

Newbie
Newbie

Posts: 6

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 09, 2015 5:02 pm

Re: CMake Questions (Please post them here)

I cant do a out of source build. My executables get stored in a directory called bin which is in my main directory. Can somebody tell me which parameters to change so that the make command puts the exectuables in a directory of my choice.
<<

alvarolinares

Newbie
Newbie

Posts: 15

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 09, 2015 5:11 pm

Re: CMake Questions (Please post them here)

I can't figure out how to run cmake on Euler.

I followed the instructions on how to submit the homework (with the folders, CMakeLists.txt files, and my .c files of question 2 and 3). I uploaded everything to Euler.
But now I would like to try if it works.

Anyone knows how to do it? Thanks.
<<

nirvedhmeshram

Newbie
Newbie

Posts: 6

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 09, 2015 5:12 pm

Re: CMake Questions (Please post them here)

I figured my problem out. I was calling ccmake from the wrong directory. We have to call it from the build directory as mentioned in the first post in the thread
<<

kaizhao

Newbie
Newbie

Posts: 21

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 09, 2015 5:53 pm

Re: CMake Questions (Please post them here)

How do we use flags with CMake? E.g. -g flag for problem 4 or -Wall flag to make the compiler whinny.

Also, is there a faster way to clean to folder before submission. I currently have to delete the bin folder, delete CMakeFiles, delete cmake_install.cmake, and delete Makefile to clean it up. With a Makefile that I manually type, I can include script for "make clean". E.g. https://www.gnu.org/software/make/manua ... eanup.html
<<

ramsaimanojbamdhamravuri

Newbie
Newbie

Posts: 16

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 09, 2015 6:44 pm

Re: CMake Questions (Please post them here)

Add set(CMAKE_BUILD_TYPE Debug) line to your CMakeLists.txt file
<<

HammadM

Supreme Overlord
Supreme Overlord

Posts: 37

Joined: Wed Sep 03, 2008 12:23 pm

Unread post Wed Sep 09, 2015 8:08 pm

Re: CMake Questions (Please post them here)

Once you have the files on euler, make a new directory outside of the folder with the source files.
for example if you have your source in a folder called me759_homework, make a folder at the same level called build_me759_homework. Then in this folder run:

  Code:
cmake ../me759_homework/
make


This tells cmake to generate the build files in the current directory ( build_me759_homework ) using the CMakeLists.txt up one directory and in the folder called me759_homework. Then you can run make to compile the code
<<

pkrishna

Newbie
Newbie

Posts: 9

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 09, 2015 9:40 pm

Re: What file do we need to submit

Hi
what all file do i need to submit ? I was able to create makefile using cmake is that all is required or do i need to submit the whole folder
<<

HammadM

Supreme Overlord
Supreme Overlord

Posts: 37

Joined: Wed Sep 03, 2008 12:23 pm

Unread post Wed Sep 09, 2015 10:15 pm

Re: CMake Questions (Please post them here)

Submit the source folder with the CMakeLists.txt, not the generated makefiles
<<

zhenyuanshen

Newbie
Newbie

Posts: 17

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Thu Sep 10, 2015 1:08 am

Re: CMake Questions (Please post them here)

My makefile contains some absolute local paths and it only works on Euler, therefore I just submit the source code with the CMakeLists.txt and the grader could generate the makefile. I am wondering how to avoid these absolute local paths so next time I can submit the makefile directly. Thank you.
<<

HammadM

Supreme Overlord
Supreme Overlord

Posts: 37

Joined: Wed Sep 03, 2008 12:23 pm

Unread post Thu Sep 10, 2015 10:37 am

Re: CMake Questions (Please post them here)

You cannot avoid them, like I said earlier, submit the cmake files along with your code, the grader can generate the makefiles using them. The CMakeLists.txt should not have any absolute paths
Next

Return to ME759 Fall 2015: High Performance Computing

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.