CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

GPU compilation for hybrid vortex/finite volume Method

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 22, 2014, 03:38
Default GPU compilation for hybrid vortex/finite volume Method
  #1
New Member
 
Join Date: Dec 2012
Location: Tokyo, Japan
Posts: 5
Rep Power: 13
Frivole is on a distinguished road
Hello,
I am working on a hybrid vortex method/finite volume method. I already have a C++ implementation of the vortex method and I have decided to use OpenFOAM for the FVM part.
In the vortex method, to solve the N-body problem we use a GPU function. To compile it we first compile the cuda part with nvcc and then we link using g++. The makefile is:
Code:
INCLUDE = -I/opt/cuda/include -I.
LIBS = -Wl,-rpath,/opt/cuda/lib64 -L/opt/cuda/lib64 -lcuda -lcudart

CXX = g++
LD  = g++       
CXXFLAGS = -O2 -Wall $(INCLUDE)
LDFLAGS = -O2
NVCC = nvcc
NVCCFLAGS = $(INCLUDE)

SRC= $(wildcard *.C)
SRCU= $(wildcard *.cu)
OBJ= $(SRC:.C=.o) $(SRCU:.cu=.o)
EXE = main

all: $(EXE)

.SUFFIXES: .cu
.cu.o:
    $(NVCC) $(NVCCFLAGS) -c $< -o $@
.C.o:
    $(CXX) $(CXXFLAGS) -c $< -o $@

main: $(OBJ)
    $(LD) $(LDFLAGS) $(OBJ) $(LIBS) -o $@
So to compile the hybrid method, I was wondering if it was possible to modify wmake to do the same thing.

Thank you
Frivole is offline   Reply With Quote

Old   March 31, 2014, 19:38
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 17
kmooney is on a distinguished road
I've only worked with cuda solvers outside of OF but the latest foam-3.0 has a few nvcc compiled linear solvers coupled with it. You might be able to get a few hints on this here:

foam-extend-3.0/src/cudaSolvers/

And the respective Allwmake, Make/options, Make/files

Cheers!
Kyle
kmooney is offline   Reply With Quote

Old   April 3, 2014, 23:05
Default
  #3
New Member
 
Join Date: Dec 2012
Location: Tokyo, Japan
Posts: 5
Rep Power: 13
Frivole is on a distinguished road
Hi Kyle,

Thanks for your answer!!
As you suggested I looked at the foam-extend-3.0 and decided to use it.
The installation went well, however when I run the Allwmake.firstInstall I get:
Code:
Cuda compiler detected at /opt/cuda/bin/nvcc;
cudaSolvers will be compiled by default.


$CUDA_ARCH is required by nvcc compiler but not set.
Check section '-gpu-architecture' in 'man nvcc' for details.
People seems to have the same kind of issue in the thread:
extend-3.0 cuda installation
So I will try to look for a solution there.
Thanks again,

Pierre
Frivole is offline   Reply With Quote

Old   April 4, 2014, 13:31
Default
  #4
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 17
kmooney is on a distinguished road
Hi Pierre,

Take a look at this file:

/foam-extend-3.0/wmake/rules/linux64Gcc/nvcc


There you can see how $CUDA_ARCH is actually added to the compiler flags. Maybe you know enough about nvcc compilers such that you know what the env variable is supposed to be set as.

Cheers!
Kyle
kmooney is offline   Reply With Quote

Old   April 7, 2014, 04:57
Default
  #5
New Member
 
Join Date: Dec 2012
Location: Tokyo, Japan
Posts: 5
Rep Power: 13
Frivole is on a distinguished road
Hi Kyle,

I am sorry for answering so late.
In fact I had an issue with my swak4Foam, and, after reinstalling it, Allmake ran without problems. However when after I try to compile the a solver with cuda I got that kind of error :
Code:
Found nvcc  --  enabling CUDA support.
make: *** No rule to make target `fastBiot/fastBiot.dep', needed by `Make/linux64Gcc46DPOpt/dependencies'.  Stop.
make: *** Waiting for unfinished jobs....
So I copy paste the rules/linux64Gcc/nvcc file into rules/linux64Gcc46/nvcc without any success...
Frivole is offline   Reply With Quote

Reply

Tags
gpu, nvcc, vortex method, wmake


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
The aspect ratio of the volume elements in Finite Volume Method CharlieTan84 Main CFD Forum 3 August 28, 2012 02:34
Control volume based finite difference method? mukut.medhi Main CFD Forum 3 August 24, 2012 10:01
Help regarding implementing the Finite Volume method for meridional flows shreyasr Main CFD Forum 0 July 23, 2012 07:05
Finite Volume Method cfd seeker Main CFD Forum 3 September 8, 2011 04:36
Control Volume Finite Element Method gerardosrez Main CFD Forum 0 March 16, 2011 14:49


All times are GMT -4. The time now is 10:28.