-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First version with working meson builder configuration, with all unit…
… tests. Still have some work to do, like receiving compiling flags for debug and for release, changing the source files used. Still, working
- Loading branch information
1 parent
fee5d7a
commit 98277f4
Showing
6 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -----nbody------ # | ||
|
||
nbody_files = files('nbody.f90') | ||
nbody_kernel_files = files('nbody.cl') | ||
|
||
nbody_obj = custom_target('nbody_kernel', | ||
input: nbody_kernel_files, | ||
output: 'nbody.cl.o', | ||
command: [python_exe, script, '@INPUT@', '@OUTPUT@']) | ||
|
||
# -platform query- # | ||
|
||
platform_query_files = files('platform_query.f90') | ||
platform_query_kernel_files = files('platform_query.cl') | ||
|
||
platform_query_obj = custom_target('platform_query_kernel', | ||
input: platform_query_kernel_files, | ||
output: 'platform_query.cl.o', | ||
command: [python_exe, script, '@INPUT@', '@OUTPUT@']) | ||
|
||
# ------sum------- # | ||
|
||
sum_files = files('sum.f90') | ||
sum_kernel_files = files('sum.cl') | ||
|
||
sum_obj = custom_target('sum_kernel', | ||
input: sum_kernel_files, | ||
output: 'sum.cl.o', | ||
command: [python_exe, script, '@INPUT@', '@OUTPUT@']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
externalSources = files( | ||
'clfortran/clfortran.f90', | ||
'fortran-utils/futils_sorting.f90', | ||
'M_strings/M_strings.f90' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import sys | ||
import shutil | ||
import os | ||
import random | ||
|
||
inputFile = sys.argv[1] | ||
aux = 'fclKernels.cl' | ||
outputFile = sys.argv[2] | ||
|
||
actualFolder = os.getcwd() | ||
folder = '/tmp/' + str(random.randint(1,1e15)) | ||
os.system(f'mkdir {folder}') | ||
shutil.copyfile(inputFile,folder + '/' + aux) | ||
os.chdir(folder) | ||
os.system(f'ld -r -b binary {aux} -o {actualFolder}/{outputFile}') | ||
os.chdir(actualFolder) | ||
os.system(f'rm -rf {folder}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
project('Focal','fortran') | ||
|
||
subdir('external') | ||
subdir('src') | ||
opencl_dep = dependency('OpenCL') | ||
|
||
# ---NonDebug Library--- # | ||
focalNonDebugFileList = sources + nonDebugFile + externalSources | ||
libFocal = static_library('Focal', focalNonDebugFileList, | ||
fortran_args: ['-std=f2008', '-fimplicit-none'] | ||
) | ||
|
||
libFocal_dep = declare_dependency(link_with: libFocal, | ||
dependencies: opencl_dep) | ||
|
||
# ----Debug Library---- # | ||
focalDebugFileList = sources + debugFile + externalSources | ||
libFocalDbg = static_library('FocalDbg', focalDebugFileList, | ||
fortran_args: ['-std=f2008', '-fimplicit-none'] | ||
) | ||
|
||
libFocalDbg_dep = declare_dependency(link_with: libFocalDbg, | ||
dependencies: opencl_dep) | ||
|
||
# ------Examples------ # | ||
python_exe = find_program('python') | ||
script = join_paths(meson.source_root(),'getCLBinary.py') | ||
subdir('examples') | ||
|
||
executable('nbody',[nbody_files,nbody_obj], | ||
dependencies: libFocal_dep) | ||
executable('sum',[sum_files,sum_obj], | ||
dependencies: libFocal_dep) | ||
executable('platform_query',[platform_query_files,platform_query_obj], | ||
dependencies: libFocal_dep) | ||
|
||
# -------Tests-------# | ||
subdir('test') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
sources = files( | ||
'Focal_Error.f90', | ||
'Focal.f90', | ||
'Focal_HostMemory.f90', | ||
'Focal_Memory.f90', | ||
'Focal_Profile.f90', | ||
'Focal_Query.f90', | ||
'Focal_Setup.f90', | ||
'Focal_Utils.f90', | ||
) | ||
|
||
debugFile = files('Focal_NoDebug.f90') | ||
nonDebugFile = files('Focal_Debug.f90') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
progs = [ | ||
#['testExample',['testExample.cl', 'testExample.f90']], | ||
['testEvents',['testEvents.cl', 'testEvents.f90']], | ||
['testFileSource',['testFileSource.cl', 'testFileSource.f90']], | ||
['testKernelSetup',['testKernelSetup.cl', 'testKernelSetup.f90']], | ||
['testLocalMem',['testLocalMem.cl', 'testLocalMem.f90']], | ||
['testMemoryTransfer',['testMemoryTransfer.cl', 'testMemoryTransfer.f90']], | ||
['testPinnedMemory',['testPinnedMemory.cl', 'testPinnedMemory.f90']], | ||
['testProfiling',['testProfiling.cl', 'testProfiling.f90']], | ||
['testQueuePool',['testQueuePool.cl', 'testQueuePool.f90']], | ||
['testSubBuffers',['testSubBuffers.cl', 'testSubBuffers.f90']] | ||
] | ||
|
||
moduleFocal_Test_Utils = files('Focal_Test_Utils.f90') | ||
|
||
foreach p : progs | ||
openCL_obj = custom_target(p[0] + '_kernel', | ||
input: p[1][0], | ||
output: p[1][0] + '.o', | ||
command: [python_exe, script, '@INPUT@', '@OUTPUT@']) | ||
|
||
exe = executable(p[0],[openCL_obj, p[1][1], moduleFocal_Test_Utils], | ||
dependencies: libFocal_dep) | ||
|
||
test(p[0], exe) | ||
endforeach |