FAQ  •  Login

CMake Questions (Please post them here)

<<

pkrishna

Newbie
Newbie

Posts: 9

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Fri Sep 11, 2015 12:00 am

Re: CMake Questions (Please post them here)

Is there any command to clean the folder after we use cmake
<<

HammadM

Supreme Overlord
Supreme Overlord

Posts: 37

Joined: Wed Sep 03, 2008 12:23 pm

Unread post Fri Sep 11, 2015 12:22 am

Re: CMake Questions (Please post them here)

If you mean cleaning up the CMake cache then the easiest way to do it is to delete the file called CMakeCache.txt and the folder called CMakeFiles

If by clean you mean cleaning the build you can run "make clean"
<<

jiashenboon

Newbie
Newbie

Posts: 34

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Sat Sep 12, 2015 3:46 pm

Re: CMake Questions (Please post them here)

I'm trying to wrap my head around how to think of the SLURM batch script.

1. Am I right to say that submitting the batch script is like running the bash commands within the script from the head node terminal (but with additional GPU/core resources etc)? I noticed that if my slurm script calls a bin that generates a file, the file will end up in my directory. What if I want the file to end up in another arbitrary location like a subdir?

2. Does SLURM obey normal bash scripting commands like for-loops etc? Can I bake those commands into my slurm batch script?

3. How does the SLURM batch script fit into a workflow that has cmake? Say my src files are in ~/src and with cmake all my bins end up in ~/build/bin. Should I create my slurm script in ~/src and call it from there? Or do I tell cmake to copy the slurm script to ~/build/bin and run it from there?

Jia-Shen

(Sorry I ended up posting this question here because the questions started when cmake screwed up my workflow)
<<

HammadM

Supreme Overlord
Supreme Overlord

Posts: 37

Joined: Wed Sep 03, 2008 12:23 pm

Unread post Sat Sep 12, 2015 4:24 pm

Re: CMake Questions (Please post them here)

1. When you run a job through slurm it gets executed on a compute node with the specified number of cores/gpus if they are available. Nothing gets run on the head node when using slurm.
You should be able to set the working path of the slurm job and then specify paths relative to that working path.

2. I am pretty sure that you can write bash for loops, they should be executed on whatever compute node gets allocated to you. I would try it and see what happens.

3. The best thing to do would be to have cmake copy the slurm script from the source directory to the build directory and then you can run it from there
<<

baoyunge

Newbie
Newbie

Posts: 37

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 16, 2015 10:56 pm

Re: CMake Questions (Please post them here)

HammadM wrote:Submit the source folder with the CMakeLists.txt, not the generated makefiles


We don't need to make the files? As for me in homework 2 I encountered several errors while I tried to make files. I guess it's because of the compile option (I notice the default compiler is gcc). But there's no problem when I test them separately using g++ compiler. Thus I am wondering how is the grader going to check the code without generated makefiles? Besides, how to change the compiler option in CMakeFiles.txt.

Thanks!
Baoyun Ge
<<

S12ali

Newbie
Newbie

Posts: 38

Joined: Mon Jan 23, 2012 9:07 pm

Unread post Wed Sep 16, 2015 11:07 pm

Re: CMake Questions (Please post them here)

baoyunge wrote:
HammadM wrote:Submit the source folder with the CMakeLists.txt, not the generated makefiles


We don't need to make the files? As for me in homework 2 I encountered several errors while I tried to make files. I guess it's because of the compile option (I notice the default compiler is gcc). But there's no problem when I test them separately using g++ compiler. Thus I am wondering how is the grader going to check the code without generated makefiles? Besides, how to change the compiler option in CMakeFiles.txt.

Thanks!
Baoyun Ge


Hi Baoyun,

If for now this issue has not been solved, feel free to submit without a CMakeLists.txt file or a Makefile. At least for now, I've got no problem on compilation.
<<

kema

Newbie
Newbie

Posts: 41

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Thu Sep 17, 2015 12:12 pm

Re: CMake Questions (Please post them here)

How can I get my cuda program compiled on Euler? When I run cmake on euler head node, it failed with the following information:
  Code:
CMake Error at /usr/share/cmake/Modules/FindCUDA.cmake:539 (message):
  Specify CUDA_TOOLKIT_ROOT_DIR
Call Stack (most recent call first):
  ParallelUtils.cmake:108 (find_package)
  CMakeLists.txt:5 (enable_cuda_support)

I also tried to submit the building task to some other nodes with gpu (using sbatch with --gres=gpu:1), and it still gave me such error.
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Fri Sep 18, 2015 10:36 am

Re: CMake Questions (Please post them here)

What do you see if you first do this:
>> module load cuda/7.0.28
and then try to do what you wanted to do?
Any difference?
Dan
<<

kema

Newbie
Newbie

Posts: 41

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Fri Sep 18, 2015 8:56 pm

Re: CMake Questions (Please post them here)

Dan Negrut wrote:What do you see if you first do this:
>> module load cuda/7.0.28
and then try to do what you wanted to do?
Any difference?
Dan


This works for me. Thanks!
<<

minghaodai

Newbie
Newbie

Posts: 13

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 30, 2015 12:24 pm

Re: CMake Questions (Please post them here)

Hi

When I tried to rum cmake I met following error messages. I have tried out some methods mentioned in other posts but none them works. :(

  Code:
include could not find load file:

    ParallelUtils.cmake

CMake Error at CMakeLists.txt:20 (enable_cuda_support):
  Unknown CMake command "enable_cuda_support".
<<

adammarkkaplansperling

Newbie
Newbie

Posts: 16

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 30, 2015 1:11 pm

Re: CMake Questions (Please post them here)

minghaodai wrote:Hi

When I tried to rum cmake I met following error messages. I have tried out some methods mentioned in other posts but none them works. :(

  Code:
include could not find load file:

    ParallelUtils.cmake

CMake Error at CMakeLists.txt:20 (enable_cuda_support):
  Unknown CMake command "enable_cuda_support".


ParallelUtils.cmake is actually a file you need to download from here and include in your homework folder: https://github.com/uwsbel/ParallelUtils-cmake
<<

minghaodai

Newbie
Newbie

Posts: 13

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 30, 2015 3:42 pm

Re: CMake Questions (Please post them here)

It is in the homework directory. That's why im confusing.
<<

jiashenboon

Newbie
Newbie

Posts: 34

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Wed Sep 30, 2015 9:27 pm

Re: CMake Questions (Please post them here)

Is anyone else having big problems with getting a simple .cu file to compile with CMake?

I just have a single .cu file
  Code:
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
    printf("Hello world!\n");
    return 0;
}


And with the following CMakeLists.txt

  Code:
cmake_minimum_required(VERSION 2.8)
find_package("CUDA" REQUIRED)
cuda_add_executable(simple_example simple_example.cu)


But I get a big chunk of compilation errors that includes

  Code:
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/stddef.h(432): error: identifier "nullptr" is undefined

/usr/lib/gcc/x86_64-redhat-linux/4.8.3/include/stddef.h(432): error: expected a ";"

/usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++config.h(1861): error: expected a ";"

/usr/include/c++/4.8.2/exception(63): error: expected a ";"


and the above goes on until 'Error limit is reached'. I got my simple example to cmake/make by adding the following into CMakeLists.txt

  Code:
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-arch=compute_20;-code=sm_20)


But the moment I add "Include(ParallelUtils.cmake) enable_cuda_support()", the blast of compilation errors come back again. I've tried all the other suggestions including >> module load cuda/7.0.28 and downloading ParallelUtils.cmake into my homework folder, but I still get the same error. I have a working implementation of question 1 that I can compile and run find with just barebones nvcc/sbatch, but I haven't gotten it to work with CMake. I've tried incorporating all the sample code from the notes but the above error messages are persistent. Hoping I can get some tips here.
<<

michaeltaylor

Newbie
Newbie

Posts: 27

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Fri Oct 02, 2015 2:20 pm

Re: CMake Questions (Please post them here)

I was running into the same issue. From what I gathered, the issue had to do with using c++11.

If that is what you are doing, try adding the following line to ~/.bashrc
module load cuda gcc/4.9.2

Then use the following CMAKE file:
  Code:
# Set the required version of CMake
cmake_minimum_required(VERSION 2.8)
# Set your project title
project(ME759_Homework)

# Include macros from the ParallelUtils library
include(ParallelUtils.cmake)

enable_cuda_support()
if(UNIX)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++11")
endif()

#The following will put all binary files in a "bin" directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#Add subdirectories for each homework
add_subdirectory(homework_01)
add_subdirectory(homework_02)
add_subdirectory(homework_03)


Best of Luck,

Mike
<<

shashankgupta

Newbie
Newbie

Posts: 16

Joined: Fri Sep 04, 2015 12:51 pm

Unread post Sat Oct 03, 2015 11:44 am

Re: CMake Questions (Please post them here)

In yesterday's HW, I was getting different sized bin files with and without using cmake. Without cmake I got every computation/output as expected (bin file size 500Kb), but with cmake my bin file was relatively much smaller (30Kb) and also the output file was blank. Following are both the cmake files used by me : Please point out if I missed anything :
Master cmakelists.txt :
# Set the required version of CMake
cmake_minimum_required(VERSION 2.8)
# Set your project title
project(ME759_Homework)

include(ParallelUtils.cmake)

enable_cuda_support()

#The following will but all binary files in a "bin" directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

#Add subdirectories for each homework
add_subdirectory(homework_03)


Subdirectory Cmakelists.txt :

cuda_add_executable(hw03_p01 hw03_p01.cu)
cuda_add_executable(hw03_p02_32 hw03_p02_32.cu)
cuda_add_executable(hw03_p02_1024 hw03_p02_1024.cu)

I didnt get any error anytime.

Thanks in advance
PreviousNext

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.