Mercurial > hg > Members > tatsuki > Alice
comparison src/main/java/alice/test/codesegment/local/bitonicsort/SortConfig.java @ 345:8f71c3e6f11d
Change directory structure Maven standard
author | sugi |
---|---|
date | Wed, 16 Apr 2014 18:26:07 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
344:9f97ec18f8c5 | 345:8f71c3e6f11d |
---|---|
1 package alice.test.codesegment.local.bitonicsort; | |
2 | |
3 import org.msgpack.annotation.Message; | |
4 | |
5 @Message | |
6 public class SortConfig { | |
7 public int length = 1200; | |
8 public int MAX_BLOCK_SIZE = 1024; | |
9 public int cpu = 1; | |
10 | |
11 public SortConfig(){} | |
12 | |
13 public SortConfig(String[] args){ | |
14 for (int i=0;i<args.length; i++){ | |
15 if ("-l".equals(args[i])){ | |
16 length = Integer.parseInt(args[++i]); | |
17 } else if ("-b".equals(args[i])){ | |
18 MAX_BLOCK_SIZE = Integer.parseInt(args[++i]); | |
19 } | |
20 } | |
21 if (length<MAX_BLOCK_SIZE) MAX_BLOCK_SIZE = length; | |
22 } | |
23 | |
24 public int getLength() { | |
25 return length; | |
26 } | |
27 | |
28 public int getblockSize() { | |
29 return MAX_BLOCK_SIZE; | |
30 } | |
31 | |
32 public int getSplitNum(){ | |
33 if (length / cpu < MAX_BLOCK_SIZE){ | |
34 return cpu; | |
35 } else { | |
36 return (length + MAX_BLOCK_SIZE -1) / MAX_BLOCK_SIZE; | |
37 } | |
38 } | |
39 } |