US tech stocks rallied, with Apple hitting a new all-time high, but other sectors experienced more muted performances.