Skip to content

Commit 4ae70d8

Browse files
Merge branch 'master' into aws_ec2
2 parents 59e42b8 + 9e37de5 commit 4ae70d8

14 files changed

+203
-113
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
1515
XMLDict = "228000da-037f-5747-90a9-8195ccbf91a5"
1616

1717
[compat]
18+
AbstractTrees = "0.4"
1819
CpuId = "0.3"
1920
JSON = "0.21"
2021
Scratch = "1"

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PlatformAware.jl
22

3-
[![TagBot](https://github.com/decarvalhojunior-fh/PlatformAware.jl/actions/workflows/TagBot.yml/badge.svg)](https://github.com/decarvalhojunior-fh/PlatformAware.jl/actions/workflows/TagBot.yml)
4-
[![CompatHelper](https://github.com/decarvalhojunior-fh/PlatformAware.jl/actions/workflows/CompatHelper.yml/badge.svg)](https://github.com/decarvalhojunior-fh/PlatformAware.jl/actions/workflows/CompatHelper.yml)
3+
[![TagBot](https://github.com/PlatformAwareProgramming/PlatformAware.jl/actions/workflows/TagBot.yml/badge.svg)](https://github.com/decarvalhojunior-fh/PlatformAware.jl/actions/workflows/TagBot.yml)
4+
[![CompatHelper](https://github.com/PlatformAwareProgramming/PlatformAware.jl/actions/workflows/CompatHelper.yml/badge.svg)](https://github.com/PlatformAwareProgramming/PlatformAware.jl/actions/workflows/CompatHelper.yml)
55

66

77
_A package for improving the practice of **platform-aware programming** in Julia_.
@@ -230,9 +230,9 @@ Therefore, we suggest the following general guideline for package developers who
230230
3. Identify the target execution platforms to which you want to provide specialized methods for each kernel function. You can choose a set of execution platforms for all kernels, or you can select one or more platforms for each kernel independently. For helping your choice, look at the following information sources:
231231
- the [table of supported _platform **parameters**_](https://docs.google.com/spreadsheets/d/1n-c4b7RxUduaKV43XrTnt54w-SR1AXgVNI7dN2OkEUc/edit?usp=sharing), which will help you to know which assumptions _PlatformAware.jl_ already allow you to make about the target execution platorm;
232232
- the database of supported _platform **features**_, where the features of the models of processors and accelerators that are currently suported by _PlatformAware.jl_ are described:
233-
- AMD [accelerators](https://github.com/decarvalhojunior-fh/PlatformAware.jl/blob/master/src/features/qualifiers/amd/db-accelerators.AMD.csv) and [processors](https://github.com/decarvalhojunior-fh/PlatformAware.jl/blob/master/src/features/qualifiers/amd/db-processors.AMD.csv);
234-
- Intel [accelerators](https://github.com/decarvalhojunior-fh/PlatformAware.jl/blob/master/src/features/qualifiers/intel/db-accelerators.Intel.csv) and [processors](https://github.com/decarvalhojunior-fh/PlatformAware.jl/blob/master/src/features/qualifiers/intel/db-processors.Intel.csv);
235-
- NVIDIA [accelerators](https://github.com/decarvalhojunior-fh/PlatformAware.jl/blob/master/src/features/qualifiers/nvidia/db-accelerators.NVIDIA.csv).
233+
- AMD [accelerators](https://github.com/PlatformAwareProgramming/PlatformAware.jl/blob/master/src/features/qualifiers/amd/db-accelerators.AMD.csv) and [processors](https://github.com/PlatformAwareProgramming/PlatformAware.jl/blob/master/src/features/qualifiers/amd/db-processors.AMD.csv);
234+
- Intel [accelerators](https://github.com/PlatformAwareProgramming/PlatformAware.jl/blob/master/src/features/qualifiers/intel/db-accelerators.Intel.csv) and [processors](https://github.com/PlatformAwareProgramming/PlatformAware.jl/blob/master/src/features/qualifiers/intel/db-processors.Intel.csv);
235+
- NVIDIA [accelerators](https://github.com/PlatformAwareProgramming/PlatformAware.jl/blob/master/src/features/qualifiers/nvidia/db-accelerators.NVIDIA.csv).
236236

237237
4. For each platform you select, define a set of assumptions about its features that will guide your implementation decisions. In fact, it is possible to define different assumptions for the same platform, leading to multiple implementations of a kernel for the same platform. For example, you might decide to implement different parallel algorithms to solve a problem according to the number of nodes and the interconnection characteristics of a cluster.
238238

@@ -244,11 +244,11 @@ Therefore, we suggest the following general guideline for package developers who
244244

245245
Contributions are very welcome, as are feature requests and suggestions.
246246

247-
Please [open an issue](https://github.com/decarvalhojunior-fh/PlatformAware.jl) if you encounter any problems.
247+
Please [open an issue](https://github.com/PlatformAwareProgramming/PlatformAware.jl) if you encounter any problems.
248248

249249
# License
250250

251-
_PlatformAware.jl_ is licensed under the [MIT License](https://github.com/decarvalhojunior-fh/PlatformAware.jl/blob/master/LICENSE)
251+
_PlatformAware.jl_ is licensed under the [MIT License](https://github.com/PlatformAwareProgramming/PlatformAware.jl/blob/master/LICENSE)
252252

253253
[build-img]: https://img.shields.io/github/workflow/status/JuliaEarth/ImageQuilting.jl/CI
254-
[build-url]: https://github.com/decarvalhojunior-fh/PlatformAware.jl/actions
254+
[build-url]: https://github.com/PlatformAwareProgramming/PlatformAware.jl/actions

src/PlatformAware.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,20 @@ end
5252

5353
export
5454
@platform,
55+
@quantifier,
5556
@atleast,
5657
@atmost,
5758
@between,
5859
@just,
5960
@unlimited,
6061
@api,
61-
PlatformFeature,
62+
PlatformType,
6263
QuantifierFeature,
6364
QualifierFeature,
6465
Query,
6566
Yes,
6667
No,
67-
Maintainer,
68+
Provider,
6869
OnPremise,
6970
CloudProvider,
7071
MachineFamily,

src/features/default/Platform.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
[node]
99

10-
node_count = 1
1110
node_provider = "OnPremise"
1211
node_virtual = "No"
1312
node_dedicated = "Yes"

src/features/detection.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ function loadDBs!()
1111

1212
database_path = @get_scratch!("database_path")
1313

14-
procdb_intel_url = "https://raw.githubusercontent.com/platform-aware-programming/PlatformAware.jl/master/src/features/qualifiers/intel/db-processors.Intel.csv"
15-
procdb_amd_url = "https://raw.githubusercontent.com/platform-aware-programming/PlatformAware.jl/master/src/features/qualifiers/amd/db-processors.AMD.csv"
16-
accdb_intel_url = "https://raw.githubusercontent.com/platform-aware-programming/PlatformAware.jl/master/src/features/qualifiers/intel/db-accelerators.Intel.csv"
17-
accdb_amd_url = "https://raw.githubusercontent.com/platform-aware-programming/PlatformAware.jl/master/src/features/qualifiers/amd/db-accelerators.AMD.csv"
18-
accdb_nvidia_url = "https://raw.githubusercontent.com/platform-aware-programming/PlatformAware.jl/master/src/features/qualifiers/nvidia/db-accelerators.NVIDIA.csv"
14+
procdb_intel_url = "https://raw.githubusercontent.com/PlatformAwareProgramming/PlatformAware.jl/master/src/features/qualifiers/intel/db-processors.Intel.csv"
15+
procdb_amd_url = "https://raw.githubusercontent.com/PlatformAwareProgramming/PlatformAware.jl/master/src/features/qualifiers/amd/db-processors.AMD.csv"
16+
accdb_intel_url = "https://raw.githubusercontent.com/PlatformAwareProgramming/PlatformAware.jl/master/src/features/qualifiers/intel/db-accelerators.Intel.csv"
17+
accdb_amd_url = "https://raw.githubusercontent.com/PlatformAwareProgramming/PlatformAware.jl/master/src/features/qualifiers/amd/db-accelerators.AMD.csv"
18+
accdb_nvidia_url = "https://raw.githubusercontent.com/PlatformAwareProgramming/PlatformAware.jl/master/src/features/qualifiers/nvidia/db-accelerators.NVIDIA.csv"
1919

2020
# procdb_intel_fname = "/home/heron/Dropbox/Copy/ufc_mdcc_hpc/PlatformAware/PlatformAware.jl/src/features/qualifiers/intel/db-processors.Intel.csv" #joinpath(database_path,basename(procdb_intel_url))
2121
# procdb_amd_fname = "/home/heron/Dropbox/Copy/ufc_mdcc_hpc/PlatformAware/PlatformAware.jl/src/features/qualifiers/amd/db-processors.AMD.csv" #joinpath(database_path,basename(procdb_amd_url))
@@ -433,9 +433,9 @@ function identifyProcessor()
433433
get!(cdict,c[:id],c[:value])
434434
end
435435
processor_core_count = parse(Int64,cdict["enabledcores"])
436-
processor_core_threadscount = parse(Int64,cdict["threads"])
436+
processor_core_threads_count = parse(Int64,cdict["threads"])
437437
438-
push!(l,(p["product"],processor_core_count, processor_core_threadscount,lc))
438+
push!(l,(p["product"],processor_core_count, processor_core_threads_count,lc))
439439
440440
end
441441

src/features/features.jl

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# Licensed under the MIT License. See LICENCE in the project root.
33
# ------------------------------------------------------------------
44

5-
abstract type PlatformFeature end
5+
abstract type PlatformType end
66

7-
abstract type QuantifierFeature <: PlatformFeature end
8-
abstract type QualifierFeature <: PlatformFeature end
7+
abstract type QuantifierFeature <: PlatformType end
8+
abstract type QualifierFeature <: PlatformType end
99

1010
@enum FeatureType qualifier=1 api_qualifier quantifier
1111

@@ -22,6 +22,7 @@ global feature_type = Dict(
2222
:node_memory_bandwidth => quantifier,
2323
:node_memory_type => qualifier,
2424
:node_memory_frequency => quantifier,
25+
:node_coworker_count => qualifier,
2526
:processor_count => quantifier,
2627
:processor_manufacturer => qualifier,
2728
:processor_microarchitecture => qualifier,
@@ -111,34 +112,39 @@ end
111112
function get_quantifier_from_number(n)
112113

113114
if n>0
114-
115115
magnitude = Dict(0 => "", 1 => "K", 2 => "M", 3 => "G", 4 => "T", 5 => "P", 6 => "E")
116116

117117
l = log(2,n)
118-
a = round(l)
118+
a = floor(l)
119119
b = isinteger(l) ? a : a + 1;
120120

121121
# the following loop separates a and b in multiplier*magnitude (see the POPL's paper).
122122

123123
# let A = 2^a
124-
m=0
124+
m1=0
125125
while a>9
126126
# loop invariant: A = 2^a * 2^(10*m)
127127
a = a - 10
128+
m1 = m1 + 1
129+
end
130+
131+
m2=0
132+
while b>9
133+
# loop invariant: A = 2^a * 2^(10*m)
128134
b = b - 10
129-
m = m + 1
135+
m2 = m2 + 1
130136
end
131137

132-
a_str = "AtLeast" * string(Integer(2^a)) * magnitude[m]
133-
b_str = "AtMost" * string(Integer(2^b)) * magnitude[m]
138+
a_str = "AtLeast" * string(Integer(2^a)) * magnitude[m1]
139+
b_str = "AtMost" * string(Integer(2^b)) * magnitude[m2]
134140
else
135141
a_str = "AtLeast0"
136142
b_str = "AtMost0"
137143
end
138144

139145
a_type = getfield(@__MODULE__, Meta.parse(a_str))
140146
b_type = getfield(@__MODULE__, Meta.parse(b_str))
141-
Tuple{a_type,b_type}
147+
Tuple{a_type,b_type,n}
142148
end
143149

144150

@@ -165,15 +171,15 @@ function get_qualifier(feature)
165171
getfield(@__MODULE__, Meta.parse(feature))
166172
end
167173

168-
function check_blank_feature(parameter_id, feature, default_platform_types)
174+
function check_blank_feature(parameter_id, feature, platform_feature_default)
169175
if (feature == "na")
170-
default_platform_types[parameter_id]
176+
platform_feature_default[parameter_id]
171177
elseif (feature == "unset")
172-
default_platform_types[parameter_id]
178+
platform_feature_default[parameter_id]
173179
elseif (feature == "unknown")
174-
default_platform_types[parameter_id]
180+
platform_feature_default[parameter_id]
175181
elseif (feature == "ignore")
176-
default_platform_types[parameter_id]
182+
platform_feature_default[parameter_id]
177183
else
178184
nothing
179185
end
@@ -203,7 +209,7 @@ function identifyAPI_oldversion(api_string)
203209

204210
end
205211

206-
function get_api_qualifier(api_string, default_platform_types)
212+
function get_api_qualifier(api_string, platform_feature_default)
207213

208214
apis = split(api_string,';')
209215

@@ -224,27 +230,27 @@ function get_api_qualifier(api_string, default_platform_types)
224230

225231
end
226232

227-
function loadFeaturesSection!(dict, actual_platform_arguments, default_platform_types)
233+
function loadFeaturesSection!(dict, platform_feature, platform_feature_default)
228234

229235
if ("0" in keys(dict))
230236
dict = dict["0"]
231237
end
232238

233239
for (parameter_id, feature) in dict
234240
p = Meta.parse(parameter_id)
235-
v0 = check_blank_feature(p, feature, default_platform_types)
241+
v0 = check_blank_feature(p, feature, platform_feature_default)
236242
v = if (isnothing(v0))
237-
feature_type[p] == qualifier ? get_qualifier(feature) : feature_type[p] == api_qualifier ? get_api_qualifier(feature, default_platform_types) : get_quantifier(feature)
243+
feature_type[p] == qualifier ? get_qualifier(feature) : feature_type[p] == api_qualifier ? get_api_qualifier(feature, platform_feature_default) : get_quantifier(feature)
238244
else
239245
v0
240246
end
241-
actual_platform_arguments[p]= v
247+
platform_feature[p]= v
242248
end
243249
end
244250

245-
function loadFeatures!(dict, default_platform_types, actual_platform_arguments)
251+
function loadFeatures!(dict, platform_feature_default, platform_feature)
246252
loadDBs!()
247253
for key in ["node", "processor", "accelerator", "memory", "storage", "interconnection"]
248-
loadFeaturesSection!(dict[key], actual_platform_arguments, default_platform_types)
254+
loadFeaturesSection!(dict[key], platform_feature, platform_feature_default)
249255
end
250256
end

src/features/qualifiers/amd/db-processors.AMD.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
,,processor_core_count,processor_clock,processor_core_threadscount,processor_isa,processor_simd,processor_microarchitecture,processor,processor_manufacturer,processor_tdp,processor_core_L1_size,processor_core_L2_size,processor_L3_size,node_memory_bandwidth,node_memory_type
1+
,,processor_core_count,processor_clock,processor_core_threads_count,processor_isa,processor_simd,processor_microarchitecture,processor,processor_manufacturer,processor_tdp,processor_core_L1_size,processor_core_L2_size,processor_L3_size,node_memory_bandwidth,node_memory_type
22
AMD;Turion,TL64,2,2.2G,2,64-bit,MMX;Now3Dx;SSE;SSE2;SSE3,unset,AMDTurion_TL64,AMD,35,unset,1MB,unset,667M,DDR2
33
AMD;Turion,TL60,2,2.0G,2,64-bit,MMX;Now3Dx;SSE;SSE2;SSE3,unset,AMDTurion_TL60,AMD,31,unset,1MB,unset,667M,DDR2
44
AMD;Turion,TL56,2,1.8G,2,64-bit,MMX;Now3Dx;SSE;SSE2;SSE3,unset,AMDTurion_TL56,AMD,31,unset,unset,unset,unset,unset

src/features/qualifiers/common.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,16 @@ abstract type ISA_x86_64_v4 <: ISA_x86_64_v3 end
113113

114114
abstract type ISA_IA_64 <: ProcessorISA end
115115

116-
117116
export ISA_x86_32, ISA_x86, ISA_x86_64, ISA_AMD_64, ISA_x86_64_v1, ISA_x86_64_v2, ISA_x86_64_v3, ISA_x86_64_v4, ISA_IA_64
118117

119118

119+
abstract type WorkerCount end
120+
abstract type NoCoworkers <: WorkerCount end
121+
abstract type PerNode <: WorkerCount end
122+
abstract type PerProcessor <: WorkerCount end
123+
abstract type PerCore <: WorkerCount end
124+
abstract type PerThread <: WorkerCount end
125+
abstract type PerVCPU <: WorkerCount end
126+
abstract type Unmapped <: WorkerCount end
127+
128+
export PerNode, PerProcessor, PerCore, PerThread, PerVCPU

src/features/qualifiers/intel/db-processors.Intel.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
,,processor_core_count,processor_clock,processor_core_threadscount,processor_isa,processor_simd,processor_microarchitecture,processor,processor_manufacturer,processor_tdp,processor_core_L1_size,processor_core_L2_size,processor_L3_size
1+
,,processor_core_count,processor_clock,processor_core_threads_count,processor_isa,processor_simd,processor_microarchitecture,processor,processor_manufacturer,processor_tdp,processor_core_L1_size,processor_core_L2_size,processor_L3_size
22
Intel;Xeon;W,3275M,28,2.50G,56,64-bit,AVX-512,CascadeLake,IntelXeon_W_3275M,Intel,205,unset,unset,unset
33
Intel;Xeon;W,3265M,24,2.70G,48,64-bit,AVX-512,CascadeLake,IntelXeon_W_3265M,Intel,205,unset,unset,unset
44
Intel;Xeon;W,3245M,16,3.20G,32,64-bit,AVX-512,CascadeLake,IntelXeon_W_3245M,Intel,205,unset,unset,unset

src/features/quantifiers/atleast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# automated declaration of at-least quantifier types
66

7-
abstract type AtLeast0 <: QuantifierFeature end
7+
abstract type AtLeast0 <: QuantifierFeature end; export AtLeast0
88

99
let mul_super = 0
1010
mag_ = ""

src/features/quantifiers/atmost.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# automated declaration of at-most quantifier types
77

8-
abstract type AtMostInf <: QuantifierFeature end
8+
abstract type AtMostInf <: QuantifierFeature end; export AtMostInf
99

1010
let mul_super = "Inf" ,
1111
mag_ = "" ;
@@ -15,13 +15,14 @@ let mul_super = "Inf" ,
1515
nm1 = Symbol("AtMost" * string(mul) * mag)
1616
nm2 = Symbol("AtMost" * string(mul_super) * mag_super)
1717
@eval abstract type $nm1 <: $nm2 end
18+
@eval export $nm1
1819
mul_super = mul
1920
end
2021
mag_ = mag
2122
end
2223
end
2324

24-
abstract type AtMost0 <: AtMost1n end
25+
abstract type AtMost0 <: AtMost1n end; export AtMost0
2526

2627

2728

src/features/quantifiers/macros.jl

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,52 @@
22
# Licensed under the MIT License. See LICENCE in the project root.
33
# ------------------------------------------------------------------
44

5+
macro quantifier(n)
6+
get_quantifier(n)
7+
end
8+
59
macro atleast(n)
610
N = n==:∞ || n==:inf ? "AtLeastInf" : "AtLeast" * string(n)
7-
Meta.parse("Tuple{" * N * ",AtMostInf}")
11+
Meta.parse("Type{<:Tuple{$N,AtMostInf,X} where X}")
12+
end
13+
14+
macro atleast(n,x)
15+
N = n==:∞ || n==:inf ? "AtLeastInf" : "AtLeast" * string(n)
16+
esc(Meta.parse("Type{<:Tuple{$N,AtMostInf,$(x)}}"))
817
end
918

1019
macro atmost(n)
1120
N = n==:∞ || n==:inf ? "AtMostInf" : "AtMost" * string(n);
12-
Meta.parse("Tuple{AtLeast0," * N * "}")
21+
Meta.parse("Type{<:Tuple{AtLeast0,$N,X} where X}")
22+
end
23+
24+
macro atmost(n,x)
25+
N = n==:∞ || n==:inf ? "AtMostInf" : "AtMost" * string(n);
26+
Meta.parse("Type{<:Tuple{AtLeast0,$N,$(x)}}")
1327
end
1428

1529
macro between(m,n)
1630
M = m==:∞ || n==:inf ? "AtLeastInf" : "AtLeast" * string(m)
1731
N = n==:∞ || n==:inf ? "AtMostInf" : "AtMost" * string(n)
18-
Meta.parse("Tuple{" * M * "," * N * "}")
32+
Meta.parse("Type{<:Tuple{$M,$N,X} where X}")
33+
end
34+
35+
macro between(m,n,x)
36+
M = m==:∞ || n==:inf ? "AtLeastInf" : "AtLeast" * string(m)
37+
N = n==:∞ || n==:inf ? "AtMostInf" : "AtMost" * string(n)
38+
Meta.parse("Type{<:Tuple{$M,$N,$(x)}}")
1939
end
2040

2141
macro just(m)
2242
M = m==:∞ || m==:inf ? "AtLeastInf" : "AtLeast" * string(m)
2343
N = m==:∞ || m==:inf ? "AtMostInf" : "AtMost" * string(m)
24-
Meta.parse("Tuple{" * M * "," * N * "}")
44+
Meta.parse("Type{<:Tuple{$M,$N,X} where X}")
45+
end
46+
47+
macro just(m,x)
48+
M = m==:∞ || m==:inf ? "AtLeastInf" : "AtLeast" * string(m)
49+
N = m==:∞ || m==:inf ? "AtMostInf" : "AtMost" * string(m)
50+
Meta.parse("Type{<:Tuple{$M,$N,$(x)}}")
2551
end
2652

2753
macro unrestricted()

0 commit comments

Comments
 (0)